Library to pull unique device ID from CPU chip. functions to load into a string that can be used in IoT access point ID and another to send the ID back on serial port. Tested on KL46Z but should work on STM and others by changing address where ID is located.
Dependents: stm32_print_unique_serial_number_copy bcsdk bcsdk bcsdk-sdchain
Diff: uniqueCPUID.cpp
- Revision:
- 0:b9461291f915
- Child:
- 2:08766dc8051a
diff -r 000000000000 -r b9461291f915 uniqueCPUID.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uniqueCPUID.cpp Wed Mar 09 18:04:45 2016 +0000 @@ -0,0 +1,16 @@ +#include "mbed.h" +#include "uniqueCPUID.h" + + + +void getUniqueIDAsStr(char *destStr) +{ + unsigned long *Unique = uniqueSerialAddr; + sprintf(destStr, "S%luX%luX%luX\000", Unique[0], Unique[1], Unique[2]); +} + + +void printUniqueId(Serial pc) { + unsigned long *Unique = uniqueSerialAddr; + printf("Simple Serial# %08luX %08luX %08luX\n", Unique[0], Unique[1], Unique[2]); +} \ No newline at end of file