3 years, 9 months ago.

HOW to get unique ID

AS title ,HOW to get unique ID ,what code could get unique ID

Question relating to:

Affordable and flexible platform to ease prototyping using a STM32F401RET6 microcontroller.
Comment on this question

1 Answer

3 years, 9 months ago.

/media/uploads/juthi/stm32f4_unique_id.png

https://developer.mbed.org/questions/3829/Can-somebody-confirm-that-the-96bits-uni/

so for your STM32F401RE, try the following:

#include "mbed.h"

// unique ID test

// change this UID address to suit your model of CPU (see datasheet)
// for STM32F401RE - see chapter 24 page 831 of the following document
//
// http://www.st.com/st-web-ui/static/active/en/resource/technical/document/reference_manual/DM00096844.pdf
//
unsigned long *uid = (unsigned long *)0x1FFF7A10; 

Serial pc(USBTX, USBRX); // tx, rx 

int main() {
   while(1)
   {
       pc.printf("\r\nUnique ID: %08X %08X %08X \r\n", uid[0], uid[1], uid[2]);
       }
}

It working. TKS!!

posted by ben chen 23 Feb 2016