I have a device based on LPC54605J512 with my own written bootloader and application. Once the device is manufactured it's programmed at the factory, assembled, and after that, I don't have access to SWD or ISP pins.
In order to update the bootloader code, the only available option for my device is a software call of ISP USB 1 MSC mode. If USB1 MSC programming will fail the device will be permanently bricked. I can't consider other options like executing bootloader code from RAM, SWD programming, or other ISP modes. So far I never had problems with USB1 MSC programming.
My task is to protect the bootloader from accidental erase by application code.
So for this purpose, I have tested the ECRP sector protection on the OM13092 dev board. For the demonstration, I have created a simple project for OM13092. Three firmware image bin files and the MCUXpresso project are in the attachment.
Image 1, first flash sector is protected by ECRP = 0x2a43e, USER_LED1 blinks.
Image 2, first two flash sectors are protected by ECRP = 0x2a43d, USER_LED2 blinks.
Image 3, firmware is unprotected, ECRP = 0, USER_LED3 blinks.
Describing the problem.
Once firmware with ECRP is programmed to the board, I can't update it with the new firmware with ECRP via ISP USB1 MSC.
Example:
OK - successful firmware update, LEDs blinking properly.
FAIL - update hung up, the firmware is not working after that, LEDs don't blink, USB device unrecognized.
1) MCU flash erased, update to any image - OK.
2) MCU programmed with image 3, update to image 1 or to image 2 - sometimes FAIL, sometimes OK. If enter ISP mode after FAIL device name will become CRP_ENABLD, so I assume that at least ECRP is written to the flash.
3) MCU programmed with image 1 or 2, update to image 3 - sometimes FAIL, sometimes OK. If enter ISP mode after FAIL device name will not change CRP_ENABLD.
4) MCU programmed with image 1, update to image 2 - FAIL. If enter ISP mode after FAIL the device name doesn't change CRP_ENABLD.
5) MCU programmed with image 2, update to image 1 - FAIL. If enter ISP mode after FAIL the device name doesn't change CRP_ENABLD.
I have tried to use different USB cables and different USB ports but it didn't help.
I'm not sure that the ECRP image can be updated via ISP USB1 MSC, but can't find information about that in the user manual. In some cases, the ECRP image is updated successfully with the image without ECRP, so I would be glad to hear any answers or proposals from NXP engineers.