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
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
Now there is....
Damn weekends. Cause you to think about work anyway...
In having time to think longer about NXPs response and asking
myself why is there a requirement to have HEAP memory - it hit
If you use the 'out of the box' setups in the startup_LPC17xx.s
file the stack was located (in my memory map) from 0x10000068 to
0x10000268. When I then added in some HEAP memory, the HEAP memory
was then located to where the original stack space was. The stack (in
my map file) location was relocated to then start at a RAM location
around 0x10001700 or so.
In the LPC17xx Users Manual it states the following: "ISP commands
use on-chip RAM from 0x1000 0118 to 0x1000 01FF. The user could use
this area, but the contents may be lost upon reset."
This memory is: Right in the middle of the application stack
The tech support reps comment: "When you enter ISP via the
re-invoke ISP command it assumes you already have stack space setup."
means to me that when you enter ISP mode from application code (via
command 57) it will use the current stack pointer (of the
application) instead of the stack pointer it normally would use from
a power up/reset.
If this is so, I believe this issue could now be corrected with
the following variable attribute declaration in application code:
Heap memory should then be allowed to be returned to 0 if not
i tried changing the heap value but in the midway of programming, it stops uploading the file into MCU. any suggestion?
Note that you're replying to 10 year old thread!
pooja_bluprints said:any suggestion
As this is all NXP-specific stuff - nothing to do with Keil or ARM - you'd probably be better asking NXP.
Try one of the CMSIS-Pack examples for the LPC17xx devices, and make sure it works with that.
That will eliminate any hardware / OTP issues
More about the board and device
few other reference links
... or make a new post, and provide more details.
View all questions in Keil forum