defragster
Senior Member+
Indeed @MM, I meant had not seen all those #defines in one place
Last edited:
Do you have any idea why the reported USB serialnumber has an additional zero padded?
void setup() {
char ID[32];
sprintf(ID, "%08lX %08lX %08lX %08lX", SIM_UIDH, SIM_UIDMH, SIM_UIDML, SIM_UIDL);
Serial.begin(115200);
while (!Serial);
pinMode(13, OUTPUT);
digitalWrite(13, HIGH); // just to show that serial port is opened
delay (1000);
Serial.print("Reading 128-bit UniqueID from chip: ");
Serial.println(ID);
}
void loop() {
}
The 4 32-bit UID registers are defined in the firmware in kinetis.h, so you should be able to reference/print them from your sketch...
Unfortunately, I'm not that familiar with coding C++ to access these registers.
#define SIM_UIDH (*(const uint32_t *)0x40048054) // Unique Identification Register High
#define SIM_UIDMH (*(const uint32_t *)0x40048058) // Unique Identification Register Mid-High
#define SIM_UIDML (*(const uint32_t *)0x4004805C) // Unique Identification Register Mid Low
#define SIM_UIDL (*(const uint32_t *)0x40048060) // Unique Identification Register Low
And this is the output on the serial monitor: "Reading 128-bit UniqueID from chip: A4210000 70E10003 00254018 31374E45"
What's the ID of your Teensy?