2023-02-28 05:03 PM
dear ST / reader,
our application uses the STM32H743. We need a unique serial number to be stored in this micro, in non-volatile memory, to uniquely identify each board. There’s no on-board EEPROM, so we were wondering if this device includes any internal unique number of its own that can be accessed and which could then be used for this purpose when we found the following …
The “Unique device ID register (96 bits)�? which is “unique for any device and in any context�?. Does this mean the value will be different in each and every STM32H743, or all STM32H743s have the same number ?
What is the procedure to read this value, please ?
2023-02-28 06:12 PM
Each IC has a different number, composed of lot, wafer, die, etc
It's a constant in addressable memory, you can read it like any other memory, you can use a pointer, or library abstractions.
/**
* @brief Return the first word of the unique device identifier (UID based on 96 bits)
* @retval Device identifier
*/
uint32_t HAL_GetUIDw0(void)
{
return(READ_REG(*((uint32_t *)UID_BASE)));
}
/**
* @brief Return the second word of the unique device identifier (UID based on 96 bits)
* @retval Device identifier
*/
uint32_t HAL_GetUIDw1(void)
{
return(READ_REG(*((uint32_t *)(UID_BASE + 4U))));
}
/**
* @brief Return the third word of the unique device identifier (UID based on 96 bits)
* @retval Device identifier
*/
uint32_t HAL_GetUIDw2(void)
{
return(READ_REG(*((uint32_t *)(UID_BASE + 8U))));
}