Electronic – Injecting UUIDs into ROM during production

assemblyidentificationmicrocontrollerproductionrom;

I'm brand new to electronics and was wondering if someone could explain to me how individual MCU/MPU-powered electronics units can be assigned unique identities on the factory line.

For instance, lets say a particular device is being built. This device has an MCU/MPU (still don't fully understand their difference) that has a CPU, ROM to hold a binary/RTOS and RAM for running that binary at runtime. A control program is flashed to the ROM at some point during production.

Say this device has the need to be given a UUID that can be read from memory when the control program starts up. Obviously, each device needs a different (unique) ID. And so I would imagine that the MCU would undergo two different phases during its production build: an initial flashing of the control program to ROM, followed by a second flashing that "appends" (without overwriting, that is) a device-specific UUID to a specific address in ROM. The control program would then be hardcoded to look for the value (UUID) stored at this address at startup.

Am I on track here, or is there a more efficient/different/standard way of accomplishing such a task? And I guess I would generalize it beyond a UUID and ask the same question of any situation where all units share a binary (the control program) but then also have their own unique information that must be present in ROM at startup.

Best Answer

The way you describe is a valid one, at least it's one we use in our projects. First we flash the whole program which contains an initial set of values, so the program will run fine. During calibration the serial number (UUID) of the device will be set, along with the other calibration factors. For this we reserve a flash page at the end of the flash, so an update of the program is possible without erasing the calibration constants.

For this to work, of course, you need some way of communicating with the controller and a program part which will do the writing to the flash. If your product is not designed to have that, you have to inject that data during the initial flashing. For that you can change the hex file on the fly for each (the format is rather easy) or use capabilities of the flasher to include an automatically incremented serial number or something like that. The capabilities of the flashers are also quite different - for example, Segger produces some with quite good production programming capabilities.

If you just need a way to identify a device without a requirement for what that UUID has to look like, microcontrollers often have some device info in them, among others an ID. Whether that is usable has to be determined for every microcontroller type you use, as there is no standard that I am aware of.

For example the STM32F401 (a device I'm currently working with) has a 96-bit Unique Device ID which can be read by the CPU and with JTAG. (more details in the reference manual)