PostHeaderIcon ST72F325K4 Flash Program Cloning: Where a Copy Stops Being a Replacement

A ST72F325K4 flash program cloning project succeeds or fails on a question that is almost never asked at the quotation stage: what else, besides the firmware, makes a unit work? The image is necessary and it is not sufficient, and the gap between a device that boots and a device that can be shipped is where most cloning projects quietly fail.

The failures are not dramatic. They appear as units that work on the bench and drift in the field, as products whose serial numbers collide, as assemblies whose measurements are three percent off. Each has a specific cause, and each cause is checkable before production begins.

The word clone and the assumption inside it

The assumption is that a microcontroller is a container for a program, and that copying the program copies the product. For a product that does nothing but blink a light, the assumption holds.

For anything that measures, communicates, identifies itself, or interacts with a calibrated sensor, it does not. The firmware is the same on every unit; the values it operates on are not.

what a unit needs to work is it in the image is it the same on every unit
the program yes yes
calibration constants sometimes, as defaults no
a unique identity no no
matched external components no varies by batch
correct package and pinout no yes, if the same part

Checklist one: the firmware is not the whole product

Calibration is the first thing to check and the most common cause of drift.

A product that measures a physical quantity converts a sensor reading into a number using constants. Those constants may be measured per unit at production and written into memory, or they may be drawn from a component’s tolerance class and be identical across a batch. Which of the two applies changes the cloning project entirely.

where the constants come from cloning consequence
measured per unit, stored in flash each clone needs its own calibration, or it will be inaccurate
measured per unit, stored in an external EEPROM the EEPROM has to be copied too, and it is not in the MCU image
from a component tolerance class, identical across the batch cloning transfers correctly
from a trim value programmed by the factory not in the image at all

The second and fourth rows are the ones that surprise people. An external EEPROM holding calibration is outside the scope of a flash read, and a factory trim value lives in a region that the normal read does not cover.

Checklist two: identity and uniqueness

A product that reports a serial number, participates in a network, or is paired with another device has an identity, and that identity has to be unique per unit.

Where the identity lives determines what a clone does to it. If it is derived from a unique identifier inside the microcontroller, every clone will have a different identifier, which may be correct or may break the product’s own bookkeeping. If it is a counter stored in flash, every clone will carry the same counter value, which produces duplicate identities the moment two units are on the same network.

identity source behaviour of a clone risk
derived from an internal unique ID differs per unit may be correct, may break pairing
stored constant in flash identical across all clones duplicate identities on a network
written at production into a reserved block identical unless rewritten duplicates, and no way to tell them apart
external identity component absent from the clone the product cannot identify itself

Checklist three: the parts around the microcontroller

The firmware was written against a specific set of external components, and those components have tolerances, revisions and second sources.

Three specific problems recur. A sensor with a different sensitivity curve makes the firmware’s calibration wrong even when the calibration data was copied faithfully. A memory device with a different page size makes a write routine that was tuned to the original fail intermittently. And a power supply with a different startup ramp makes a firmware that assumed a fast ramp fail to initialise.

external part what the firmware assumes what a clone might get wrong
analogue sensor a sensitivity curve offset error across the range
serial memory a page size and timing intermittent write failures
regulator a startup ramp initialisation timeout
crystal or resonator a frequency and tolerance communication timing drift

Checklist four: package and pinout

The physical part has to fit. That sounds trivial until a customer substitutes a differently packaged variant of the same silicon and finds that the pinout is not identical.

Within a family, the same die is offered in packages with different pin counts, and the pin assignments are not always a superset. A clone built on a convenient package may be electrically correct and mechanically impossible, or may route a signal to a pin that the product’s board does not connect.

check how to verify cost of getting it wrong
pin count and pitch datasheet against the board the part does not fit
pin assignment schematic against the datasheet the wrong net is driven
thermal pad presence mechanical drawing assembly rework
programming pins accessible board layout cannot be programmed in circuit

Checklist five: the production programming step

A clone programme is a manufacturing process, not a file. It needs a programming method, a fixture, a test, and a record of what was programmed into which unit.

The most common failure at this stage is a device that was programmed but not verified, so a handful of units in a batch carry a corrupt image and fail at the customer’s site rather than at the factory. The second most common is a device that was programmed correctly and then had its configuration bytes set to something other than what the original had.

step what must be recorded why
image programmed checksum, tool, date traceability
image verified pass or fail per unit catches corrupt writes
configuration set the exact option byte values behaviour depends on them
functional test the measurements taken catches calibration error

What “verified clone” should mean

The phrase should mean that a sample unit was taken from the batch, tested against the original on the parameters the product actually delivers, and found equivalent. Not identical inside — equivalent in output.

That distinction lets a cloning project be honest about what it cannot reproduce. An exact internal copy may be impossible if a trim value was never readable. An output-equivalent clone is achievable, and it is what a customer needs.

level of equivalence what it means achievable when
identical image the same bytes at the same addresses the source unit was fully readable
identical behaviour the same outputs for the same inputs calibration was transferred or re-measured
interchangeable functions in the same system, including identity all five checklists pass

Service, and what it cannot promise

What is offered is the image recovery, a transfer plan for whatever calibration is recoverable, and a statement of what could not be recovered and how that limitation will show up in the product.

What is not promised is that a clone will be indistinguishable from the original. Whether it is depends on facts outside the microcontroller: what the sensor does, where the identity comes from, and how the product is tested. Those are questions for the customer’s engineering team, and the useful thing a recovery can do is tell them exactly which ones to answer.

The unlock-versus-recover distinction that determines what is even available is covered in ST72F324BJ flash memory unlocking, and the delivery format that makes a clone programme reproducible is described in ST72F325S6 embedded flash binary file. Where the clone’s firmware needs to be understood rather than merely copied, ST72F321BAR9T6 source code extraction is the relevant next step.

Comments are closed.