cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a unique ID available to read from each MCU?

infoinfo978
Associate II
Posted on October 07, 2011 at 11:21

Hello,

I'd like to know if there is a unique ID available on each STM32F10x, that can be read from ROM, and that can not be changed by the user.

I would like to realise a copy-protection function with that ID.

if yes, can you please show how to read this ID on a STM32F107VC?

thanks and best regards!
13 REPLIES 13
Posted on October 07, 2011 at 13:18

There should be a 96-bit ID at the back end of the ''ROM'' 0x1FFFF000 (ie 32-bit values at +0x7E8,0x7EC,0x7F0)

From Reference Manual RM0008

29.2 Unique device ID register (96 bits)

 

The unique device identifier is ideally suited:

 

�? for use as serial numbers (for example USB string serial numbers or other end

 

applications)

 

�? for use as security keys in order to increase the security of code in Flash memory while

 

using and combining this unique ID with software cryptographic primitives and

 

protocols before programming the internal Flash memory

 

�? to activate secure boot processes, etc.

 

The 96-bit unique device identifier provides a reference number which is unique for any

 

device and in any context. These bits can never be altered by the user.

 

The 96-bit unique device identifier can also be read in single bytes/half-words/words in

 

different ways and then be concatenated using a custom algorithm.

 

Base address: 0x1FFF F7E8

 

 

unsigned long *Unique = (unsigned long *)0x1FFFF7E8;

printf(''%08X %08X %08X\n'', Unique[0], Unique[1], Unique[2]);
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Artur1
Associate II
Posted on October 11, 2011 at 15:04

I've tried to read the register, but there are just 0xFF. Is there a special trick to get the id? I use ride7 for stm32f107 programming.

Thx

Posted on October 11, 2011 at 17:26

I've tried to read the register, but there are just 0xFF. Is there a special trick to get the id? I use ride7 for stm32f107 programming.

 

I'm predominantly using 103 devices, I'm not aware that the 105/107 devices are materially different with respect to the Unique ID registers. Perhaps the system rom is located at a different address, or has a different size?

I don't see any code example, but it's hard to imagine that reading a 32-bit memory location would provide a value of 0xFF. What exactly do you see if you use the fragment I provided?

unsigned long *Unique = (unsigned long *)0x1FFFF7E8;

 

 

printf(''%08X %08X %08X\n'', Unique[0], Unique[1], Unique[2]) ;

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Artur1
Associate II
Posted on October 12, 2011 at 10:12

''Every STM32F107 device has a 96-bit unique ID''

That is what the documentation says.

There is the code:

printf(''\r\nSystem init: OK'');

unsigned long *uid = (unsigned long *)0x1FFFF7E8;

printf(''\r\nUnique ID: %08X %08X %08X \r\n'', uid[0], uid[1], uid[2]);

There is the output:

System init: OK

Unique ID: FFFFFFFF FFFFFFFF FFFFFFFF

Artur1
Associate II
Posted on October 12, 2011 at 10:12

''Every STM32F107 device has a 96-bit unique ID''

That is what the documentation says.

There is the code:

printf(''\r\nSystem init: OK'');

unsigned long *uid = (unsigned long *)0x1FFFF7E8;

printf(''\r\nUnique ID: %08X %08X %08X \r\n'', uid[0], uid[1], uid[2]);

There is the output:

System init: OK

Unique ID: FFFFFFFF FFFFFFFF FFFFFFFF

danielczigany9
Associate II
Posted on October 12, 2011 at 14:37

For STM32F217ZG:

#define U_ID_0 (*(uint32_t*) 0x1FFF7A10)

#define U_ID_1 (*(uint32_t*) 0x1FFF7A14)

#define U_ID_2 (*(uint32_t*) 0x1FFF7A18)

For  STM32S107RC:

#define U_ID_0 (*(uint32_t*) 0x1FFFF7E8)

#define U_ID_1 (*(uint32_t*) 0x1FFFF7EC)

#define U_ID_2 (*(uint32_t*) 0x1FFFF7F0)

printf(''ID: %08X-%08X-%08X\r\n'',U_ID_2,U_ID_1,U_ID_0);

Artur1
Associate II
Posted on October 12, 2011 at 16:38

czigany.daniel this is the same code as above isn't?

Posted on October 12, 2011 at 18:12

Are you simulating this or running it on actual hardware?

Does the 107 have a different system rom address?

Can you park a JTAG memory view window over the system rom and examine it that way?

What values do you see at 0x1FFFF7E0 ?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Artur1
Associate II
Posted on October 13, 2011 at 13:15

>Are you simulating this or running it on actual hardware?

Its actual running on Hardware

>Does the 107 have a different system rom address?

I guess not, ROM starts @ 0x8000000 and  ROM size is 0x40000

>Can you park a JTAG memory view window over the system rom and examine it that way?

I dont know how to jump to a defined memory address, scrolling to the address is an overkill.

>What values do you see at 0x1FFFF7E0 ?

Val: FFFF0100 FFFFFFFF FFFFFFFF