TMS320LF2406: The Parameters That Live Outside the Program
A motor drive or a power converter built on this device is not one artifact. It is an algorithm plus a set of numbers, and the numbers are frequently written by a different process than the algorithm. The algorithm comes from the firmware repository. The numbers come from a calibration station, a test bench, or a spreadsheet that somebody maintained for a product line that ended years ago.
When a customer asks for a duplicate, they mean the whole thing. A copy that runs the same code with default constants is not a duplicate; it is a device that behaves differently in every situation the constants govern, which for a control loop is every situation.
Two storage patterns, two problems
The tuning values end up in one of two places, and the difference determines what the copy has to include.
In the first pattern the values are compiled in: the algorithm’s constants are initialised from flash along with everything else, and the calibration station rewrites the relevant flash sector after programming. In that case an array copy carries them automatically, and the only risk is that the sector was written after the copy was taken.
In the second pattern the values live in a separate non-volatile store, either an on-chip data region the program reads at startup or an external serial memory on the board. In that case an array copy carries none of them, and the device will boot into whatever the destination happened to hold.
| Where the tuning lives | Is it in the array copy | What goes wrong if missed |
|---|---|---|
| Compiled into the program image | Yes | Nothing, unless the copy predates calibration |
| Separate flash sector, written by the station | Usually | Defaults run; loop gain and limits are wrong |
| External serial memory on the board | No | Device boots with zeroed or stale parameters |
| Determined at first power-up and stored | No | Self-calibration runs on a different load |
What the numbers actually control
On a drive built around this device, the values that matter are not abstract. They are:
- the dead time inserted between the high and low switches of each inverter leg,
- the carrier frequency and the sampling instant within the carrier period,
- the current-sense offset and gain, which convert an ADC count into amperes,
- the speed or position loop gains, and their limits,
- the fault thresholds for overcurrent, overvoltage and stall.
Each of those has a failure mode that shows up at a different time. The dead time is the dangerous one: too little and the leg shoots through on the first switching event, which is immediately destructive. Too much and efficiency drops, which is merely expensive.
The current-sense offset is the insidious one. A wrong offset does not stop the drive; it biases every current measurement, so the loop regulates to a current that is not the current flowing, and the error appears only under load.
Finding the parameters before copying
The order that works is to characterise the source device before anything is copied:
- Read the array and identify the code sections by their characteristics rather than by the linker map, which is usually unavailable.
- Look for a region of the array that is small, written at a page boundary, and not referenced as instructions.
- Power the source device and observe which addresses are read during startup — a debugger trace or a bus capture answers this directly.
- Compare two units of the same product. Parameters that differ between units are calibration; parameters that are identical are constants.
- Record the values, their address, and their format before touching the destination.
Step four is the one that produces the most information for the least effort. Two units from the same production run differ in exactly the places that were calibrated, and those differences map out the parameter block without any documentation.
Dead time is not a constant in the source code
A detail that catches people rebuilding a drive: the dead time is often not a literal in the algorithm. It is computed from the clock, the PWM period, and a value that came from the calibration station. Reconstructing the algorithm without that value produces a plausible-looking program with a dead time of zero, because zero is what an uninitialised field holds.
The check is straightforward once you know to make it: measure the gate signals on a working unit, and measure them again on the copy. A difference in the gap between the complementary outputs is a parameter problem, not a code problem, and no amount of code review will find it.
Reproducing the copy
With the parameters in hand, the destination device is programmed in a specific order:
- Erase the destination and confirm the erase completed.
- Program the code sections.
- Program the parameter block at its original address, in its original format.
- Program the vector table if it is a separate region.
- Verify by reading back and comparing against the source, before power is applied to the load.
- First power-up with the load disconnected; measure the gate signals at the connector.
Step six is not optional on a drive. A duplicate that has a parameter error will destroy its output stage on the first commutation, and the only way to catch the error without that cost is to look at the signals before the power stage is connected.
When the parameters cannot be recovered
If the source device’s array is unreadable and the parameter store is external, the values may still be recoverable from that external memory, which is often an unprotected serial device and can be read in circuit. That is a common and frequently overlooked route: the array is locked, the tuning is not.
If neither is available, the parameters have to be re-derived. For a drive that means instrumenting a working unit, measuring the actual dead time and current-sense transfer function, and re-tuning the loops against the real load. That is a commissioning job, not an extraction job, and it should be quoted as such.
Related reading
- TMS320LF2403 and getting a monitor onto a locked device — how to read the configuration off a part whose array will not open.
- TMS320LF2407 and the identity fields a copy must change — the other half of making a duplicate behave correctly.
- TMS320F2806 and constant layout on a later family — same problem, different memory map.
FAQ
Can the parameters be read without unlocking the array? Only if they are stored outside it. When they are in a separate external device, they usually can.
Why does the copy run but regulate badly? Because the loop gains and sense offsets are defaults, not the calibrated values.
Is a parameter diff between two units always calibration? Usually. A value that differs between units of the same product was written per unit by something.
What is the risk of testing with the load connected? Destruction of the output stage. Measure at the gate driver first.
Conclusion
Replicating this device means replicating the numbers as well as the code. Find where the tuning lives, compare two units to map the block, carry it at its original address, and verify at the gate signals before connecting a load. The algorithm is the part that is easy to copy and the part that is least likely to be the problem.