Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
9 years, 8 months ago.
HOW to get unique ID
AS title ,HOW to get unique ID ,what code could get unique ID
Question relating to:
 
                
            1 Answer
9 years, 8 months ago.
  
 
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]);
       }
}
