occasional hard fault exception on using IAP command to read UID

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

occasional hard fault exception on using IAP command to read UID

跳至解决方案
1,429 次查看
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?

标签 (2)
标记 (1)
0 项奖励
回复
1 解答
1,310 次查看
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 项奖励
回复
4 回复数
1,311 次查看
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 项奖励
回复
1,310 次查看
brayannevillepa
Contributor II

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

0 项奖励
回复
1,310 次查看
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?

1,310 次查看
brayannevillepa
Contributor II

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

0 项奖励
回复