2020-03-16 06:47 AM
I am using STM32F429 nucleo 144 board for security application. I Need to read a unique ID while doing this process i am getting ST-link SN number of the device. So is SN of the microcontoller is a unique number ? or is it common number for all STM devices?? or SN and unique ID are same or different??
2020-03-16 07:38 AM
The ST-link SN number belongs to the debug probe and not to the MCU. The on-chip 96-bit unique device identifier (UID) is different and belongs to the MCU. It can be read by
uint32_t uid[3];
uid[0] = HAL_GetUIDw0();
uid[1] = HAL_GetUIDw1();
uid[2] = HAL_GetUIDw2();
I would use that e.g. as part of a personalization string for seeding a random number generator etc...
2020-03-16 07:46 AM
Thank you so much.
If possible can you please provide me the complete Code to read the unique ID of an MCU. I am new in this field so it could be helpfull if you could provide me with the complete code
2020-03-16 07:49 AM
Generate a new project in STM32cubeIDE with all default settings and insert the above lines where you need it, e.g in main() USER CODE section 2
2020-03-16 08:04 AM
2020-03-16 09:37 AM
You can execute your program step by step from the IDE and watch the variables.
Think you should start learning more about debugging and IO.
See for example the chapter on debugging/tracing here: https://gitlab.com/stm32mcu/wiki/-/wikis/home