Content originally posted in LPCWare by wella-tabor on Wed Jan 22 10:52:50 MST 2014
Hello,
I am trying to read the serial number by the IAP function (according to the app note and the datasheet) but when the function is invoked the microcontroller resets itself with RSID= 6 (LOCKUP). During the asm stepping (segger j/link), it is ok.
My system consists of two parts:
1) I call it bootloader, addr 0x0000 0000 - (0x0000 4000 - 1), it initializes peripherals, clock, SDRAM, etc. and at the end it sets VTOR to 0x0000 4000 and calls 0x0000 4000 + 4.
2) The application - To protect itself from soft-reset, accidently executing code from 0x0000 0004 (wrongly initialized function object), the addr. range 0x0000 0000 - (0x0000 4000 - 1) is disabled by MPU for access and execution.
However when the MPU is not configured in the part 2), it works.
Here is my explanation:
The IAP_serial_number remaps the portion of the Boot ROM to address 0 (via MEMMAP register). This portion contains the serial number. The function attempts to read it somewhere from the range 0x0000 0000 - (0x0000 4000 - 1) but the MPU prevents from this.
I am not sure if my explanation is right so that any advice is appreciated.
Thanks
Martin