IAP call crashes when trying to read UID

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

IAP call crashes when trying to read UID

ソリューションへジャンプ
1,217件の閲覧回数
koen2
Contributor I

I am using the LPCOpen library at the moment with MCU LPCExpresso IDE for  the LPC1830 chip.

For a project I need to read the UID of the CPU. I tried it with the following functions:

But it crashes and I don't know why. Maybe someone can help me?

I increased the cpuUID size to 5, but 4 is enough.

Program counter has weird number: 0x12345678 

uint32_t cpuUID[5] = {0};
 Chip_IAP_ReadUID(&cpuUID[0]);

//The function call crashed on this function:

/* Read the unique ID */
uint32_t Chip_IAP_ReadUID(uint32_t uid[])
{
 uint32_t command[5], result[5], i;

 command[0] = IAP_READ_UID_CMD;
//CRASH
 iap_entry(command, result); //IAP ENTRY CRASH

 for(i = 0; i < 4; i++) {
 uid[i] = result[i + 1];
 }

 return result[0];
}


‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Note in this picuture: uint32 needs to be uint32_t (line 103)

Knipsel.JPG

ラベル(1)
タグ(3)
1 解決策
1,030件の閲覧回数
bernhardfink
NXP Employee
NXP Employee

IAP is intended to deal with an internal flash. There would be commands like ReadUID which do not work directly on the flash, however it is a restriction in the flashless parts of LPC1800 and LPC4300.

See error sheet, chapter 3.4

https://www.nxp.com/docs/en/errata/ES_LPC18X0.pdf 

Regards,

Bernhard.

元の投稿で解決策を見る

2 返答(返信)
1,030件の閲覧回数
koen2
Contributor I

Thanks for you answer Bernhard. After searching in the datasheet I found the same information. 

To fix this issue I used the following code to just read the UID of the CPU:



Chip_OTP_Init(); //located in  "otp_18xx_43xx.h"
unsigned char buf[16];
uint32_t * pntrID = (uint32_t *) 0x40045000; 

memcpy(buf,pntrID,16); //this will copy from memory location 0x40045000 16 bytes into an buffer. Containing the UID.

//DumpHex(buf,16,"UUID"); //own function


‍‍‍‍‍‍‍‍‍
0 件の賞賛
返信
1,031件の閲覧回数
bernhardfink
NXP Employee
NXP Employee

IAP is intended to deal with an internal flash. There would be commands like ReadUID which do not work directly on the flash, however it is a restriction in the flashless parts of LPC1800 and LPC4300.

See error sheet, chapter 3.4

https://www.nxp.com/docs/en/errata/ES_LPC18X0.pdf 

Regards,

Bernhard.