Many connected devices leave the line with the same firmware and get their identity later, by hand. Someone types a serial number, someone else pastes a token, and a third person adds the device to the cloud. Each hand-off is a chance for a duplicate serial, a missing credential or a device that powers on at a customer and cannot connect.
What gets written
Provisioning means giving each unit three things that are unique to it:
- A serial number, taken from a counter or an allocated range, never typed.
- Credentials, such as a device certificate with its private half, or a per-device token.
- A registration record in the cloud, so the first connection is accepted.
An app on the programming station should do all three after one scan or one button press, and show a single result.
Order the steps around failure
Do the cloud side first. Ask the server to reserve a serial and create the device identity. With some platforms, such as AWS IoT, you can have the server issue the certificate. With others, the device generates its own pair and send only the certificate request, so the private part never leaves the chip.
Then flash the firmware and write the identity to the unit. On an ESP32 that is usually the NVS partition or eFuse blocks, and on an STM32 it is a reserved flash page or a secure element. Last, read the values back, compare them with what the server holds, and only then print the label.
If any step fails, the app should mark the reserved serial as void and say which step broke. Reusing a half-written serial is how two devices end up with the same identity.
Secure elements
Parts such as the Microchip ATECC608 or NXP SE050 hold the private credential in hardware, and some are provisioned at the chip vendor or on a separate step. The same app can then register the device and write only the public data. The tradeoff is that a lost credential cannot be copied out, so plan how a unit is replaced if the chip dies.
Keep a log, not the secrets
The app should record serial, firmware version, time, station and result for each unit. It should not keep private credentials on the station’s disk after the unit is done. Secrets in a shared folder on a production PC are a common finding in security reviews.
Factory floor details
Programming takes time, from a few seconds over serial to longer for a large image over a debug probe. Show a progress bar and block the next scan until the label has printed. Support a re-provision path for reworked units, with a reason that goes in the log.
What this does not cover
This is about the factory step. Rotating credentials in the field, or revoking a stolen unit, needs its own design in the cloud and the firmware. Regulations on data and device security differ by market, so check them for yours.
If your devices still get their identity by hand, see our micro-apps for electronics and manufacturing and book a discovery call.
