cancel
Showing results for 
Search instead for 
Did you mean: 

stm32 write serial number

David.Cheng
Associate II

how to write SN for hundreds MCUS​? i know j-flash can write fixed bytes,

i need to write custom 10 bytes SN which has its own generation rule

4 REPLIES 4

Segger has DLLs etc for developers to write their own code.

You could perhaps script something where you generate a small .HEX file, or a complete one, with your unique code or method.

People frequently have a pattern in the firmware they replace, or you could write into an unused area or OTP.

The ST-LINK Utility and STM32 Cube Programmer provide for a command line interface, which you could run from a script, or a Win32 app you write to wrap around them.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Your own code running on the STM32 could also provide a method to input/write serial numbers and calibration data during test or manufacture.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Jack Peacock_2
Senior III

Most production line flash programmers have a facility to sequentially program a serial number into an IC from a given range. A problem is these are usually standalone so you have to be careful about duplicate assignments, especially if there are multiple assembly lines. This gets complicated when production is split between a local plant and an offshore contract manufacturer.

A second approach is to wait until you run the assembled PCB tests in an ATE fixture. Assuming the PCBA passes functional tests the ATE can write the serial number through the JTAG or a test port command to the board. I prefer this approach for a few reasons: non-functional scrapped PCBAs are not registered in the serial number database; the ATE (one or more across multiple assembly lines) retrieves a serial number from a database to guarantee unique identity; and the indelible STM32 internal ID can be retrieved and linked to the serial number in the quality assurance database. Scrapped boards can be assigned a tracking number outside the usual serial number range for QA purposes, though there's no link to the specific board in the QA database unless an external barcode is scanned on the PCBA.

It's a tradeoff between cost and QA statistics. A standalone is cheaper since it's offline, but you need a re-reeler to extract the IC, program it, and place it back on the tape reel for the SMT pick and place. ATE tester is more complex to set up and has a single point of failure in the database, though there are ways around this, but yields more precise QA statistics.

And as a last resort...hire an intern to do it manually.

Jack Peacock

thanks!