lpcware

Discovred an error in Chip_IAP_ReadUID() function (from LPCOpen)

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by cgroen on Thu Jan 14 06:23:30 MST 2016
Discovered a "small" bug in the Chip_IAP_ReadUID() function
(with severe corruption of data....)


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

command[0] = IAP_READ_UID_CMD;
iap_entry(command, result);

for (i=0; i<4; i++)
[color=#f00]//*(uid+i) = result[i+1]; // Not good !!![/color]
[color=#6c0]*((unsigned char*)uid+i) = result[i+1]; // Quick and dirty solution that works...[/color]

return result[0];
}

Outcomes