LPC5460x Secondary bootloader not flashing successfully

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

LPC5460x Secondary bootloader not flashing successfully

68件の閲覧回数
kellykan
Contributor I

i have a secondary bootloader developed to allow me to reflash application code on my device over y modem protocol.

My bootloader is stored in flash and in the ECRP value to protect the first sector from being erased inadvertently if bootloading during a power failure for example.

however i want to be able to update the bootloader from application code. As the ECRP value locks the first page in flash - and according to documentation i must erase all sectors ( e.g mass erase) to remove the lock before i can proceed in rewriting the bootloader.

 

Q1. Is this even possible? 

Q2. Do i require a reset after erase of all sectors to clear the lock of flash sector?

Q3. I have written the code and tried it , i manage to erase the chip and flash the first page of code to sector 0 , when i flash the second page using IAP command nothing happens and subsequently my code fails on compare of page 2 with IAP status code 19 ( which is undocumented).

 

As i do not have access to uart or swd in the real application from the outside worls it needs to be done from the application if possible.

 

Kelly

 

0 件の賞賛
返信
1 返信

41件の閲覧回数
HangZhang
NXP Employee
NXP Employee

Hi @kellykan 

Q1: Is it possible to update the bootloader from application code?
Yes, it is possible, but it involves several critical steps and considerations due to the ECRP protection. The ECRP value locks the first page in flash to protect it, and typically, to update the bootloader, you must perform a mass erase to clear the ECRP protection. After the mass erase, you can reprogram the bootloader and set the ECRP value again.

Q2: Do I require a reset after erasing all sectors to clear the lock of flash sector?
Yes, a reset is generally required after a mass erase to reinitialize the flash controller and to ensure that the ECRP lock is cleared properly. Without a reset, the flash controller may still have remnants of the lock, which could cause issues during subsequent flash operations.

Q3: Issues with flashing the second page using IAP command

1. Incomplete Erase or Programming: Ensure that the mass erase was successful and that the flash sectors are correctly erased before attempting to program.
2. Incorrect IAP Command Sequence: Verify that you are using the correct sequence of IAP commands for erasing and programming flash sectors.
3. Reset Requirement: As mentioned, performing a reset after the mass erase might be necessary to clear the ECRP lock completely.

Hope this will help you.

BR

Hang

0 件の賞賛
返信