LPC17xx And IAP Command Code 57 (Reinvoke ISP)

This post is an FYI for others using the NXP LPC17xx Cortex M3 family. This may help you save some hair in your future development if you are to use the IAP Reinvoke ISP command 57.

I ran into a problem with the Reinvoke ISP command not functioning properly on while porting code from an existing LPC2103 project I relucantly inherited. Once into the ISP bootloader I could only reliably use the 'Read Device Signature' command in Flash Magic. Any other command would fail (I also tried the utility lpc21isp_179 with the same results).

After trying all I could think of it was time to contact NXP. Uncounted e-mails and a few days later after trying everything I could and NXP asked for (including sending my code to them to test with - they could not make it work with TeraTerm either), it was determined that in order to use the ISP Bootloader from code space requires that the HEAP to be setup with some non-zero value.

NXPs response was this:

"So it would help if you had some Heap space allocated !

When you enter ISP via the re-invoke ISP command it assumes you already have stack space setup.
If you move your re-invoke ISP code up into main() it works fine as is, the reason for this is you forgot to
allocate heap space in the startup_LPC17xx.s file. Or just allocate some heap space and you can
leave the function as is."

Well, I tried this out (I set the value to 0x200)and Flash Magic worked repeatedly for all commands attempted.

Bottom Line: If you use uVision 4.00a and use the file startup_LPC17xx.s - DO NOT leave the declaration Heap_Size EQU 0x00000000
if you are going to use the IAP Reinvoke ISP command (unless you call it from within main() - according to NXP).

There is currently no documentation anywhere I searched on the web that contained this requirement with resonable search criteria entered.

Now there is....

More questions in this forum