LPC804 Stuck or crash on IAP_ReadUniqueID

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

LPC804 Stuck or crash on IAP_ReadUniqueID

跳至解决方案
252 次查看
MHMart
Contributor I

I'm trying to read the Unique ID of a LPC804 but, I think it was working before, now I cannot access the UID any longer.

 

The following function makes the whole process stop and not continue. In the debugger I find that IAP_ReadUniqueID is executed (although maybe not with success?) but a breakpoint on the status check is never reached.

 

    uint32_t UIDValue = 0x00;
    status_t UIDStatus = kStatus_Fail;
    //  Read the UID
    UIDStatus = IAP_ReadUniqueID(&UIDValue);
    
    // Return when failed
    if(UIDStatus != kStatus_Success) return;
    
    // insert UID into message
    data[3] = (uint8_t)((UIDValue >> (8 * 3)) & 0xFF);
    data[4] = (uint8_t)((UIDValue >> (8 * 2)) & 0xFF);
    data[5] = (uint8_t)((UIDValue >> (8 * 1)) & 0xFF);
    data[6] = (uint8_t)(UIDValue & 0xFF);

 



Since I think it was working prior, might the flash memory have been emptied or reset? What could it be or what can I check?

0 项奖励
1 解答
231 次查看
ErichStyger
Senior Contributor V

IAP_ReadUniqueID() expects a pointer to 128bits (4 x 32bit values).

You see this if you step into IAP_ReadUniqeID().

You are passing only a pointer to 32bits, so memory gets overwritten. Fix that and it should work.

 

在原帖中查看解决方案

0 项奖励
2 回复数
232 次查看
ErichStyger
Senior Contributor V

IAP_ReadUniqueID() expects a pointer to 128bits (4 x 32bit values).

You see this if you step into IAP_ReadUniqeID().

You are passing only a pointer to 32bits, so memory gets overwritten. Fix that and it should work.

 

0 项奖励
209 次查看
MHMart
Contributor I

Thanks, amazing! That solved my issue.

I could, indeed, have figured that out by checking the function.

 


In my defense though, this documentation could be updated to fit that explenation?

https://mcuxpresso.nxp.com/api_doc/dev/2167/a00070.html#ga258d8c49d494cbd0d18321af56e11440

 

Seems an important requirement that isn't mentioned directly.

0 项奖励