Problem with LPC54608 ECRP firmware update via ISP USB 1 MSC

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Problem with LPC54608 ECRP firmware update via ISP USB 1 MSC

1,730 Views
emblink182
Contributor III

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.

0 Kudos
6 Replies

1,691 Views
Omar_Anguiano
NXP TechSupport
NXP TechSupport

Hello

The image can be updated with USB1 MSC. If you are disabling the ISP pins then you are entering ISP through IAP call, the byte 1 of the command parameter indicates the type for ISP. USB0 and USB1 will enter mass storage class ISP mode when Misc Cfg is not 0xAA.

 

nxf54944_0-1609874794655.png

 

Let me know if this is helpful, if you have more questions do not hesitate to ask me.

Best regards,

Omar

 

0 Kudos

1,666 Views
emblink182
Contributor III

Hi, yeap, that is exactly how I enter USB1 MSC mode on the device. The problem is that my firmware uses ECRP (the first two sectors of the flash are protected). I'm unable to update the firmware with USB1 MSC mode once the ECRP image is written. The update process hangs. The worst part is that the firmware is damaged after that, and I'm unable to use the IAP call again in order to enter the USB1 MSC mode, the device becomes permanently disabled.

0 Kudos

1,629 Views
Omar_Anguiano
NXP TechSupport
NXP TechSupport

Hello

 

Before making any IAP call, either disable the interrupts or ensure that the user interrupt vectors are active in RAM and that the interrupt handlers reside in RAM.

The part is permanently disabled when:

1.On-chip Image(s) are ruined

2.SWD access prohibited

3.ISP entries prohibited

 

This issue might related to the image you're loading. Regarding the ECRP you only are enabling IAP Erase/Write protection.

 

If you have more questions do not hesitate to ask me.

Best regards,

Omar

0 Kudos

1,624 Views
emblink182
Contributor III

Hello. 

Thanks for your support.

You said that "This issue might be related to the image you're loading. Regarding the ECRP you only are enabling IAP Erase/Write protection". 

I have provided images and code examples from MCUxpresso. Problem with update reproduced 100% on the OM13092 development board and with simple examples from the first post. I'm entering USB1 ISP by SW2 ISP2 button on the board and can't update the ECRP image with another ECRP image, the copy process hangs and firmware is damaged.

The question that I want to clarify is why an ECRP image can't be updated with another ECRP image via ISP USB1 mode? The problem is 100% not related to the Reinvoke ISP. I have no problems with entering ISP USB1 mode on the board by the SW2 ISP2 button.

 

0 Kudos

1,596 Views
Omar_Anguiano
NXP TechSupport
NXP TechSupport

Hello emblink182

I suggest you write this value in the ECRP (0xFFFE_A43E) Is the same as the first image with the difference of the values in the reserved field.

Let me know if the image can be updated with these values.
Best regards,
Omar

0 Kudos

1,572 Views
emblink182
Contributor III

Hello!

I have modified ECRP to 0xFFFEA43E as you recommended. With this image USB1 MSC ISP update also hangs. Update also hanged when I tried to update clean flash. After reset and second attempt device enumerated as CRP_ENABLD but the app didn't work (should glow all three LEDs). Seems like the ROM ISP bootloader hangs or has a bug in the ROM code.

0 Kudos