Skip to content

Instantly share code, notes, and snippets.

@Scottapotamas
Created April 20, 2019 12:43
Show Gist options
  • Save Scottapotamas/990be4953e506ba497c0c22edd174250 to your computer and use it in GitHub Desktop.
Save Scottapotamas/990be4953e506ba497c0c22edd174250 to your computer and use it in GitHub Desktop.
Get 128-bit UUID from SAMD21 micro - C (Arduino compatible)
uint32_t * get_chip_uuid()
{
static uint32_t uuid[3] = { 0 };
uuid[0] = *(volatile uint32_t *)0x0080A00C;
uuid[1] = *(volatile uint32_t *)0x0080A040;
uuid[2] = *(volatile uint32_t *)0x0080A044;
uuid[3] = *(volatile uint32_t *)0x0080A048;
return uuid;
}
// Usage
uint32_t * uuid_buf = get_chip_uuid(); //pointer to 128-bit UUID
for (uint8_t i = 0; i < 4; i++) {
uart_print_hex( *(uuid_buf+i) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment