2022-11-07 11:30 PM
2022-11-07 11:35 PM
Hello. I am using the micro STM32F415ZGT. I have a problem when I use the functions HAL_GetUIDw0, HAL_GetUIDw1 and HAL_GetUIDw2: I get the same value on different boards with the same model of micro. And also, if I make a modification in my project, the value that I get changes. UID_BASE address is 0x1FFF7A10UL, the offsets are 0x00, 0x04 and 0x08, as it is written on the reference manual. Thank you
2022-11-08 12:22 AM
Ok, probably I solved. From what I see, only the word 0 changes from a chip to another of the same model. Is it right?
2022-11-08 12:48 AM
this is what i have working right now.
and i never had an issue with it, never found two mcus with the same uuid in a production line of thousands.
(i needded the 96bit shrinked down to 8 bytes to fit in a canbus frame)
void readThisDeviceUUID(){
uint32_t ID_1_3_val= HAL_GetUIDw0() +HAL_GetUIDw2();
uint32_t ID_2_val= HAL_GetUIDw1();
memcpy(&uuid[0],&ID_2_val,4);
memcpy(&uuid[4],&ID_1_3_val,4);
sprintf((char *)uuidString,
"%x %x %x %x %x %x %x %x ",
uuid[0],uuid[1],uuid[2],uuid[3],uuid[4],uuid[5],uuid[6],uuid[7]
);
}
2022-11-08 12:55 AM
The impression that only DWORD 0 changes is only true in your specific case. The UID is actually always structured identically and is explained in some training documents, e.g. the one describing the Device Electronic Signature of the STM32L4 family, which can be consulted on this point:
Unique device identifier is a 96 bit register created from
So there is a good chance that your Wafer No and Lot No happen to be identical. However, if you need a clear distinction for a large number of systems produced, you must use the entire 96 bits.
Regards
/Peter