The sequence of Flash programming events related to LFU is:
- In liveDFU(), the custom bootloader writes a START field to a specific Flash location in the Flash bank being programmed
- Then the host transfers data to the device block by block (multiple bytes), which is stored in a buffer, checksum is returned to the host
- Then the custom bootloader erases the corresponding Flash sector (if not already erased)
- After the entire application image has been programmed, the custom bootloader writes a KEY field and updates the VERSION field in the Flash bank programmed. This indicates the presence of a valid application image in that Flash bank.
If the LFU process is interrupted due to a Power loss or Communication issue:
- If the interruption did not result in a device reset (e.g. failure due to communication issue), then the custom bootloader will not be able to complete downloading the application image. However, the old ISRs from the application will continue to execute, but not the background tasks. Another LFU command cannot be initiated until a device reset is performed.
- The Flash bank that was being written to would be partially programmed.
- However, since the VERSION is not updated, on the next device reset, the custom bootloader will branch to the old application in Flash and full services are resumed, with the ability to again perform LFU.