LPC804 Stuck or crash on IAP_ReadUniqueID

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

LPC804 Stuck or crash on IAP_ReadUniqueID

Jump to solution
163 Views
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 Kudos
1 Solution
142 Views
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.

 

View solution in original post

0 Kudos
2 Replies
143 Views
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 Kudos
120 Views
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 Kudos