Skip to content

Commit a32c0ad

Browse files
committed
SAMD51
1 parent 81eea8c commit a32c0ad

File tree

3 files changed

+20
-10
lines changed

3 files changed

+20
-10
lines changed

MCU.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,21 @@ The Unique Identifier is located in the first 128 bits of the Flash memory mappi
4242

4343
# Atmel SAMD ARM Microcontroller
4444

45-
Atmel SAMD21 is used in Arduino Zero / Arduino M0.
46-
4745
Each device has a unique 128-bit serial number which is a concatenation of four 32-bit words contained at the following addresses:
4846

49-
* Word 0: 0x0080A00C
50-
* Word 1: 0x0080A040
51-
* Word 2: 0x0080A044
52-
* Word 3: 0x0080A048
47+
| - | SAMD21 | SAMD51 |
48+
| :-------: | :------: | :------:|
49+
| Word 0| 0x0080A00C | 0x008061FC |
50+
| Word 1| 0x0080A040 | 0x00806010 |
51+
| Word 2| 0x0080A044 | 0x00806014 |
52+
| Word 3| 0x0080A048 | 0x00806018 |
5353

54-
The uniqueness of the serial number is guaranteed only when using all 128 bits. [Datasheet Section 9.3.3](https://cdn.sparkfun.com/datasheets/Dev/Arduino/Boards/Atmel-42181-SAM-D21_Datasheet.pdf)
54+
The uniqueness of the serial number is guaranteed only when using all 128 bits.
5555

5656
## Tested Microcontroller
5757

58-
* Atmel SAMD21 ARM Cortex-M0 - 16 bytes
58+
* Atmel SAMD21 ARM Cortex-M0 (Arduino Zero / Arduino M0) - 16 bytes - [Datasheet Section 9.3.3](https://cdn.sparkfun.com/datasheets/Dev/Arduino/Boards/Atmel-42181-SAM-D21_Datasheet.pdf)
59+
* Atmel SAMD51 ARM Cortex-M4 (Adafruit Metro M4)- 16 bytes - [Datasheet Section 9.6](http://ww1.microchip.com/downloads/en/DeviceDoc/60001507E.pdf)
5960

6061
# STM32 Microcontroller
6162

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=ArduinoUniqueID
2-
version=1.0.9
2+
version=1.1.0
33
author=Luiz Henrique Cassettari
44
maintainer=Luiz Henrique Cassettari <ricaun@gmail.com>
55
sentence=Arduino Library to gets the Manufacture Serial Number from the Atmel AVR, SAM, SAMD, STM32, and ESP Microcontroller.

src/ArduinoUniqueID.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,20 @@ ArduinoUniqueID::ArduinoUniqueID()
6868

6969
#elif defined(ARDUINO_ARCH_SAMD)
7070

71-
// from section 9.3.3 of the datasheet
71+
#if defined (__SAMD51__)
72+
// SAMD51 from section 9.6 of the datasheet
73+
#define SERIAL_NUMBER_WORD_0 *(volatile uint32_t*)(0x008061FC)
74+
#define SERIAL_NUMBER_WORD_1 *(volatile uint32_t*)(0x00806010)
75+
#define SERIAL_NUMBER_WORD_2 *(volatile uint32_t*)(0x00806014)
76+
#define SERIAL_NUMBER_WORD_3 *(volatile uint32_t*)(0x00806018)
77+
#else
78+
//#elif defined (__SAMD21E17A__) || defined(__SAMD21G18A__) || defined(__SAMD21E18A__) || defined(__SAMD21J18A__)
79+
// SAMD21 from section 9.3.3 of the datasheet
7280
#define SERIAL_NUMBER_WORD_0 *(volatile uint32_t*)(0x0080A00C)
7381
#define SERIAL_NUMBER_WORD_1 *(volatile uint32_t*)(0x0080A040)
7482
#define SERIAL_NUMBER_WORD_2 *(volatile uint32_t*)(0x0080A044)
7583
#define SERIAL_NUMBER_WORD_3 *(volatile uint32_t*)(0x0080A048)
84+
#endif
7685

7786
uint32_t pdwUniqueID[4];
7887
pdwUniqueID[0] = SERIAL_NUMBER_WORD_0;

0 commit comments

Comments
 (0)