4.3 Serial Number

Each ATmega48PB/88PB/168PB has an integrated serial number (also called unique device ID) that can be used to uniquely identify each part.

There are two approaches to get the serial number information.

One way is to read the Signature Row from software. For detailed information, refer to section "Reading the Signature Row from Software" in the latest data sheet.

Table 4-3. Signature Row Addressing
Signature ByteZ-Pointer Address
Device Signature Byte 10x0000
Device Signature Byte 20x0002
Device Signature Byte 30x0004
RC Oscillator Calibration Byte0x0001
Serial Number Byte 10x000E
Serial Number Byte 00x000F
Serial Number Byte 30x0010
Serial Number Byte 20x0011
Serial Number Byte 50x0012
Serial Number Byte 40x0013
Serial Number Byte 60x0015
Serial Number Byte 70x0016
Serial Number Byte 80x0017
Note:

If the serial number feature is used across several device families the device signature bytes should also be included in the serial number. Extending the serial number to a 12-byte number.

Another way is to read I/O address 0xF0 - 0xF8, as the ATmega48PB/88PB/168PB serial number can be accessed through I/O registers SNOBRx. The serial number is made from concatenating the nine bytes read out from these read-only registers. See sub-chapter SNOBRx - Serial Number Byte 8 to 0 for more detail.

An example of how to read out the serial number is given below:
C Code Example

uint8_t serial_num[9] = {0};

for(uint8_t i = 0; i < 9; i++){
	serial_num[i] = *((uint8_t *) &DEVID0+i);
}

SNOBRx - Serial Number Byte 8 to 0