My aim is to acquire a unique serial number for my design and reuse it as an ID in different places for my Radio communication. I have used an Atmel SAM D21 series microcontroller on my design which on the 1st sight seemed to have a serial number when I followed the following path in Atmel Studio.

Menu > Tools > Device Programming > Device Information

But no traces of any serial numbers of any sort. Just a Device Signature which repeats on all the MCUs.

I am aware that we could use a Dallas One Wire Serial chip for this purpose and apparently some AVR series have an accessible serial number in them, but in the favor of reducing the BOM and the choice of MCU I am trying not to go that way.

In the meanwhile, even though that I haven't used the feature myself, I know that SAM D series have an integrated USB module in them. Considering that every USB module should have a unique serial number (unless I am wrong), is there a method to extract that SN?

Please let me know if there are any solutions you have in mind for this purpose.

  • \$\begingroup\$ generate a random number/string and save it to the eeprom upon the first boot. \$\endgroup\$ – dandavis May 9 '17 at 7:51

The SAMD21 processors do indeed have a unique ID, as explained in the "Serial Number" section in the "Memories" chapter in the Atmel SAMD21 datasheet. (This is currently section 10.3.3, page 46). The datasheet states

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.

USB devices are expected but not required to provide a serial number, but I am not aware of any microcontroller USB peripheral that incorporates a serial number directly—all the USB peripherals I know of merely allow the processor, if desired, to provide the serial number as part of the descriptor.

  • \$\begingroup\$ I have been trying your solution and initially I thought this might be a wrong approach but now I need to know what part I am doing wrong. My question is posted here, avrfreaks.net/forum/… \$\endgroup\$ – Mehrad May 12 '17 at 1:10
  • \$\begingroup\$ Someone on the Adafruit forum claimed the code at snip2code.com/Snippet/1031839/… worked for them—what are you doing differently? \$\endgroup\$ – Abe Karplus May 12 '17 at 4:22
  • \$\begingroup\$ Seems Atmel forgot to add that region to the debugger definitions for some chips. Read the answer posted for my question for more details. Thanks for the help btw. \$\endgroup\$ – Mehrad May 15 '17 at 3:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.