lpc1788 IAP read serial number causes lockup(reset)

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

lpc1788 IAP read serial number causes lockup(reset)

632 Views
lpcware
NXP Employee
NXP Employee
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
Labels (1)
0 Kudos
2 Replies

437 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by wella-tabor on Thu Jan 23 02:31:03 MST 2014
Hi,


Quote:
Why not program your MPU settings for Read/Not-Write/No-Execute instead of
no access at all?



No access is a runtime check of correctly initialized function pointers, data pointers to Flash, etc. (at least this is some level of the check). The bootloader address range should not be used at all.

It is not problem for me to read the serial number, I have disabled and than enabled the MPU and interrupts of course. Because this is an "undocumented" feature I wanted to spread the knowledge of it.

With your description, programmers will be aware of this. Thanks.

Martin
0 Kudos

437 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by MikeSimmonds on Wed Jan 22 20:21:55 MST 2014
That is essentially correct.

Most (if not all) IAP functions use an undocumented address remapping of
some part of the address space (presumably OTP) to overlay about 2K at
address zero. In there are the unique serial number, the cpu id, on-chip
flash and ram sizes etc.

That is why interrupts MUST be disabled; the standard vector table is
no longer available [I wonder if this still true with a relocated vector table?]

As you point out, programming the MPU can (and obviously does) mess with this.

Why not program your MPU settings for Read/Not-Write/No-Execute instead of
no access at all?

Let us (the forum) know if that works.

BTW, on the 1778/1888, IAP read serial does not need any ram reservation at
top of stack. (Rom ver 1.8)

Mike.
0 Kudos