occasional hard fault exception on using IAP command to read UID

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

occasional hard fault exception on using IAP command to read UID

Jump to solution
1,064 Views
brayannevillepa
Contributor II

lpc1114‌

I use LPC1114XL controller and came across an issue with IAP command to read UID. I was using this command in background loop to service a UART request(from PC) to read information. The code works, but rarely ends up at hard fault exception handler. With bit of debugging I was able to consistently reproduce the issue.  The problem occurs when the IAP routine is preempted by an interrupt. I couldn't find this issue documented in reference manual or errata. Can someone confirm if this issue and proposed workaround?

Labels (2)
Tags (1)
0 Kudos
1 Solution
945 Views
bernhardfink
NXP Employee
NXP Employee

IAP uses a small memory area in SRAM, if you have interrupts this area might be overwritten (depending on you memory layout). This could explain the crash.

From the User Manual:

19.4.8  RAM used by ISP command handler
ISP commands use on-chip RAM from 0x1000 017C to 0x1000 025B. The user could use
this area, but the contents may be lost upon reset. Flash programming commands use the
top 32 bytes of on-chip RAM. The stack is located at (RAM top − 32). The maximum stack
usage is 256 bytes and it grows downwards.
19.4.9  RAM used by IAP command handler
Flash programming commands use the top 32 bytes of on-chip RAM. The maximum stack
usage in the user allocated stack space is 128 bytes and it grows downwards.

Regards,

Bernhard.

View solution in original post

0 Kudos
4 Replies
946 Views
bernhardfink
NXP Employee
NXP Employee

IAP uses a small memory area in SRAM, if you have interrupts this area might be overwritten (depending on you memory layout). This could explain the crash.

From the User Manual:

19.4.8  RAM used by ISP command handler
ISP commands use on-chip RAM from 0x1000 017C to 0x1000 025B. The user could use
this area, but the contents may be lost upon reset. Flash programming commands use the
top 32 bytes of on-chip RAM. The stack is located at (RAM top − 32). The maximum stack
usage is 256 bytes and it grows downwards.
19.4.9  RAM used by IAP command handler
Flash programming commands use the top 32 bytes of on-chip RAM. The maximum stack
usage in the user allocated stack space is 128 bytes and it grows downwards.

Regards,

Bernhard.

0 Kudos
945 Views
brayannevillepa
Contributor II

Ok, that probably explains it. I do have the interrupt vector table mapped to SRAM. Thanks.

0 Kudos
945 Views
converse
Senior Contributor V

I know that for programming Flash, you must disable interrupts - maybe you need to do that for any IAP command. BTW: Why don't you read the UID once (at boot time) and then just return the value when requested, instead of making multiple IAP calls?

945 Views
brayannevillepa
Contributor II

Thanks for the suggestion, I am using the IAP commands at init now. 

0 Kudos