HAL_GetUID functions do not seem to work
The HAL_GetUID functions return the same value on different chips of the same series. I am using an STM32L0 series chip. This is my code:
uint32_t serialw0 = HAL_GetUIDw0();
uint32_t serialw1 = HAL_GetUIDw1();
uint32_t serialw2 = HAL_GetUIDw2();Which returns these sames values on every chip:
205994032, 926167089, 17
Searching through the generated files this is code for the above functions:
#define UID_BASE (0x1FF80050UL) /*!< Unique device ID register base address */
uint32_t HAL_GetUIDw0(void)
{
return(READ_REG(*((uint32_t *)UID_BASE)));
}
uint32_t HAL_GetUIDw1(void)
{
return(READ_REG(*((uint32_t *)(UID_BASE + 4U))));
}
uint32_t HAL_GetUIDw2(void)
{
return(READ_REG(*((uint32_t *)(UID_BASE + 8U))));
}
Now if write my own macro:
#define STM32_UUID ((uint32_t *)(0x1FF80050))
uint32_t serialw0 = *(STM32_UUID);
uint32_t serialw1 = *(STM32_UUID+4U);
uint32_t serialw2 = *(STM32_UUID+8U);I get unique values for each chip but I don't think this is correct either:
205994032, 3432448017, 0
In fact its only word1 that seems to be unique which I suppose could be correct.
