Posts Tagged ‘nvram firmware clone’

PostHeaderIcon Six Conditions for a Clone, and Firmware Is Only One

The word clone is used for two very different outcomes. One is a unit that runs the same code. The other is a unit that a customer cannot distinguish from the original in use. The first is a copying exercise and the second is a product exercise, and the gap between them is five conditions that have nothing to do with the firmware.

This is worth setting out as a list because the list is what a project should be planned against, and because each item on it fails in a recognisable way.

Condition one: the firmware

The obvious condition, and the one that gets all the attention. It has to be complete, which means the code, the initialised data, and the configuration — the distinction drawn in extracting MCU firmware.

A firmware that is merely complete is not sufficient, and the four ways it can be complete and still wrong are in copy failures. Condition one is necessary and it is the easiest of the six.

Condition two: the option bytes

Configuration bytes set the clock source, the brown-out threshold, the boot mode, the watchdog behaviour and the debug state. They live outside the program array, they are not covered by most reads, and they are frequently not copied.

A clone with the wrong clock source runs at the wrong frequency, which changes every timing-dependent behaviour in the product. A clone with the watchdog disabled behaves differently on a fault. A clone with the debug port left open is a clone that a customer’s security assessment will flag.

Option byte Effect if wrong Observable
Clock source Wrong frequency Timing, communication errors
Brown-out threshold Resets at the wrong voltage Failures on weak supplies
Boot mode Boots the wrong region Does not start
Watchdog No reset on a fault Hangs instead of recovering
Debug enable Port open or closed Security difference

Condition three: calibration

Every unit’s oscillator, reference and analog path differ slightly, and the calibration compensates. The values are per-unit, so a clone cannot simply inherit the original’s.

Value Consequence of inheriting Consequence of omitting
Oscillator trim Small frequency error Larger frequency error
ADC gain and offset Small measurement error Larger measurement error
Reference trim Voltage error Voltage error

Either way the clone is close but not identical, and the difference shows up in measurement accuracy rather than in function. That is why the test for a clone is not “does it work” but “does it meet the specification”.

Condition four: the identifier strategy

The identifier is a decision rather than an artefact, and it has three possible answers.

Give each clone a new identifier, which is correct for a product that needs traceability. Give the clone the original’s identifier, which is correct for a repair and wrong for a new product because two units then claim the same identity. Give the clone no identifier, which works only if the firmware tolerates its absence.

Strategy Correct for Risk
New identifier per unit New production Requires an identifier source
Original’s identifier Repair of the original Duplicate identity
No identifier Firmware that does not read it Firmware may fail
Derived identifier Products with a registration step Derivation must be reproduced

The second row is the one that causes incidents. A clone carrying the original’s identifier appears in logs, licensing systems and customer records as the original, and the resulting confusion is worse than the clone.

Condition five: peripheral parameters

The firmware compensates for the components around it, and those components have tolerances.

A product whose firmware assumes a crystal with a specific load capacitance, a sensor with a specific sensitivity, or a driver with a specific gain will not work correctly with a substitute. The compensation is in the firmware as constants, and the constants were chosen for the original components.

Peripheral Firmware assumption Substitute effect
Crystal Load capacitance, ESR Frequency error or start-up failure
Sensor Sensitivity, offset Measurement error
Driver Gain, timing Actuator behaviour differs
Power supply Ripple, transient response Resets under load

This condition is the one that makes a clone a hardware project as well as a firmware one, and it is the one most often omitted from the plan.

Condition six: the mechanical and the certified

The last condition is not electronic. A clone has to fit the enclosure, mate with the connectors and satisfy the same regulatory requirements.

A clone that meets five electronic conditions and does not fit the case is a prototype. A clone sold in a regulated market without the certification that the original holds is an unlicensed product regardless of how well it works.

Aspect Requirement Consequence if omitted
Mechanical fit Same dimensions and connector positions Cannot be installed
Thermal Same dissipation Overheating
EMC Same emissions and immunity Fails certification
Safety Same isolation and creepage Regulatory failure

The failure signature of each omission

Each missing condition produces a characteristic symptom, and the symptom identifies the condition.

Symptom Missing condition
Does not boot at all Option bytes, or an incomplete firmware
Boots, runs at the wrong speed Option bytes, or calibration
Works, measurements are offset Calibration
Works, but two units report the same serial Identifier strategy
Works on a bench, fails in the enclosure Mechanical fit
Works, fails certification EMC or safety

The sixth row is the one that is discovered last and costs the most, because it is discovered after tooling and after the first production run.

How a clone project should be sequenced

The six conditions impose an order, and the order is not the order of difficulty.

Identify the reference unit and read everything: firmware, configuration, calibration, identifier. Decide the identifier strategy, because it affects how the firmware must be handled. Then choose the components, because that determines which firmware constants are valid. Then build a prototype, test it against the specification rather than against “does it work”, and only then begin certification.

Phase Condition addressed Output
Read Firmware, option bytes, calibration A complete set
Decide Identifier strategy A rule
Select Peripheral parameters A bill of materials
Prototype All electronic conditions A measured unit
Certify EMC and safety A product

What the service covers

We cover conditions one to four and we do not cover five and six, which belong to the customer’s hardware and regulatory teams.

For one to four the deliverable is a package: the image, the configuration bytes with their meaning, the calibration values with a note that they are per-unit, and an identifier scheme suitable for the intended production. The document states which of the six conditions are satisfied and which are the customer’s.

The legal question of what may be cloned is separate from the technical one and is set out in cloning an IC program. The reason a clone may be unable to accept future updates, which is a seventh condition that only appears later, is in copying MCU firmware.

What we will not do is describe a firmware image as a clone. Five of the six conditions are outside it, and a customer who plans for one is planning for a fifth of the work.