diff --git a/usb/class/dfu/device/dfudf.c b/usb/class/dfu/device/dfudf.c index 8232979..223999a 100644 --- a/usb/class/dfu/device/dfudf.c +++ b/usb/class/dfu/device/dfudf.c @@ -306,7 +306,6 @@ int32_t dfudf_init(void) usbdc_register_function(&_dfudf); usbdc_register_handler(USBDC_HDL_REQ, &dfudf_req_h); - // TODO check if firmware is corrupted and set dfuERROR state if it is return ERR_NONE; } diff --git a/usb_dfu_main.c b/usb_dfu_main.c index 81b02f8..7fd54d3 100644 --- a/usb_dfu_main.c +++ b/usb_dfu_main.c @@ -101,6 +101,9 @@ int main(void) if (!check_force_dfu() && check_application()) { // application is valid start_application(); // start application } else { + if (!check_application()) { // if the application is corrupted the start DFU start should be dfuERROR + dfu_state = USB_DFU_STATE_DFU_ERROR; + } usb_dfu(); // start DFU bootloader } }