GitHunt
MK

mkretzschmar/SAMD21Serialnumber

Library to read out unique serial number from SAM D21 MCU, e.g. Adafruit Feather M0

SAMD21Serialnumber

Library providing a function to read out the 128 bit unique serialnumber of a SAMD21 chip, e.g. Adafruit Feather M0.

For details take a look to

https://cdn.sparkfun.com/datasheets/Dev/Arduino/Boards/Atmel-42181-SAM-D21_Datasheet.pdf

(9.3.3, page 32)
Each device has a unique 128-bit serial number which is a concatenation of four 32-bit words contained at the following addresses:

  • Word 0: 0x0080A00C
  • Word 1: 0x0080A040
  • Word 2: 0x0080A044
  • Word 3: 0x0080A048

The uniqueness of the serial number is guaranteed only when using all 128 bits.

Example Code

#include <SAMD21DeviceID.h>
SAMD21 samd = SAMD21();
char serialnumber[33];
void setup() {
  Serial.begin(9600);
  samd.getSerialNumber(serialnumber);
  Serial.print("[SETUP] chip serial#: 0x");
  Serial.println(serialnumber);
}
...

Languages

C++100.0%

Contributors

GNU General Public License v3.0
Created July 30, 2019
Updated January 12, 2021
mkretzschmar/SAMD21Serialnumber | GitHunt