PostHeaderIcon 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:

  1. Read the array and identify the code sections by their characteristics rather than by the linker map, which is usually unavailable.
  2. Look for a region of the array that is small, written at a page boundary, and not referenced as instructions.
  3. Power the source device and observe which addresses are read during startup — a debugger trace or a bus capture answers this directly.
  4. Compare two units of the same product. Parameters that differ between units are calibration; parameters that are identical are constants.
  5. 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:

  1. Erase the destination and confirm the erase completed.
  2. Program the code sections.
  3. Program the parameter block at its original address, in its original format.
  4. Program the vector table if it is a separate region.
  5. Verify by reading back and comparing against the source, before power is applied to the load.
  6. 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

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.

Comments are closed.