How do I read back the serial number of a device through firmware?
Solution
On the some of the One-Time Programmable (OTP) devices, a unique serial number is written to the code space of the MCU. This serial number can be read back in firmware to distinguish between multiple devices.
On C8051T62x/32x devices, the serial number is located at locations 0x3FFC-0x3FFF. On C8051T624/5 devices, the serial number is located at locations 0x1FFC-0x1FFF. It is written such that the lest significant byte of the serial number is located at the lowest memory address.
For example, if a C8051T622 device's serial number was 0x0017A796, the location 0x3FFC would contain the value 0x96, the location 0x3FFD would contain the value 0xA7, the location 0x3FFE would contain the value 0x17, and the location 0x3FFF would contain the value 0x00.
Reading a Device's Serial Number in Firmware