cancel
Showing results for 
Search instead for 
Did you mean: 

How to take the UUID from a stmre microcontroller

 
3 REPLIES 3

Hi. In order to take the uuid from a stm32f091 microcontroller I'm using these lines of code:

#define UUID0 ((uint32_t *)0x1ffff7ac)
#define UUID1 ((uint32_t *)0x1ffff7b0)
#define UUID2 ((uint32_t *)0x1ffff7b4)
 
std::vector<unsigned char> UUID_Vector;
UUID_Vector.push_back(UUID0[3]);
UUID_Vector.push_back(UUID0[2]);
UUID_Vector.push_back(UUID0[1]);
UUID_Vector.push_back(UUID0[0]);
UUID_Vector.push_back(UUID1[3]);
UUID_Vector.push_back(UUID1[2]);
UUID_Vector.push_back(UUID1[1]);
UUID_Vector.push_back(UUID1[0]);
UUID_Vector.push_back(UUID2[3]);
UUID_Vector.push_back(UUID2[2]);
UUID_Vector.push_back(UUID2[1]);
UUID_Vector.push_back(UUID2[0]);

There UUID0[3] is the less significative byte and UUID2[0] is the most significative byte.

Is thi right?

I have written the code above according with these articles:

https://techoverflow.net/2015/02/03/reading-the-stm32-unique-device-id-in-c/

https://gist.github.com/ElectronicaXAB3/2e1085be2719990f178d0557dc8314d1

http://blog.gorski.pm/stm32-unique-id

But after having installed 50 devices based on a stm32f091 micro controller the uuid is not unique, I have found 4 duplicate uuids.

So where is the error in the code?

Uwe Bonnes
Principal III

I think it should be #define UUID0 ((uint8_t *)0x1ffff7ac).