PostHeaderIcon TMS320LF2407: Duplicating a Node Without Colliding on the Bus

Every duplication problem has a boundary condition, and on this device the boundary is the network. The LF2407 includes a CAN controller, so a product built on it is rarely a single unit; it is one of several on a bus, and each of those several has to have an identity that nobody else is using.

An exact copy is therefore wrong in a way that does not show up on the bench. The duplicate powers up, runs its program, and answers on the bus — with an identifier that another device already owns. The result ranges from a bus that behaves strangely to a machine that moves when it should not.

What the bus makes different

On a standalone device, identity does not matter. On a bus it matters at three levels, and all three are usually present at once:

  • the node address or identifier the device expects to receive commands on,
  • the set of identifiers it transmits, which must be distinguishable from its peers,
  • any serial number reported in a diagnostic message, which the network uses to tell one unit from another.

Copy all three and the network has two devices that cannot be told apart. Copy the code and change all three and the network has a working replacement.

Identity element Typical storage Consequence if duplicated
Node address / receive identifier Parameter block in flash or external memory Two nodes answer one command
Transmit identifier set Compiled into the program, sometimes offset by node address Frames attributed to the wrong unit
Serial number in diagnostics Parameter block, written per unit Diagnostics logs merge two units
Bus timing registers Computed from clock, sometimes per product Timing errors if the copy runs a different clock

Where the identity is stored

The address is rarely a hardware strap on this generation. It is a value the program reads at startup, and it lives in one of four places:

  1. A reserved word in the parameter block, written by a production station.
  2. A byte in an external serial memory, which the program reads over one of its serial ports.
  3. A calculated value derived from a serial number that is itself stored somewhere.
  4. A value learned from the network at first power-up and then saved.

The fourth case is the one that produces the strangest behaviour in a copy. The duplicate starts with an uninitialised address, asks the network to assign one, receives it, and saves it. That works exactly once — until the original device is also restarted and asks again, at which point the network has handed out the same address twice.

Reading the identity before copying

The identity can usually be established without unlocking anything, because it is visible on the wire.

Attach a bus analyser to a working unit, capture a full power-up cycle, and record every identifier the device transmits and the payload of its first diagnostic frame. That capture gives the transmit set directly. The receive set is visible in a different way: send a command to the known address and confirm the device responds.

For the serial number, a diagnostic request usually returns it. If the network has no such request, the value is in the parameter block and can be found by comparing two units, the same technique used for calibration constants.

Checking the timing registers

One element of the identity is easy to overlook because it is not an address: the bit timing. CAN timing is derived from the oscillator and a set of register values, and a product that runs at one clock frequency has timing values that only work at that frequency.

If the duplicate is built on a board from a different revision, with a different crystal, the timing registers from the source are wrong. The bus does not fail outright; it produces error frames under load, at a rate that rises with bus traffic. That symptom is routinely misdiagnosed as a wiring problem.

The check is to compare the oscillator on both boards before programming anything, and to confirm the measured bit rate on the duplicate with an analyser rather than trusting the register values.

The duplication sequence

  1. Capture the source device’s bus behaviour at power-up and under command.
  2. Locate the parameter block and read the identity fields.
  3. Copy the array, including the parameter block.
  4. Modify the destination’s identity fields: address, transmit identifier offsets if used, serial number.
  5. Program the destination and verify the array against the source except for the modified fields.
  6. Connect the duplicate to an isolated bus segment first, with the original disconnected.
  7. Confirm no error frames and no duplicate-address response, then connect to the real bus.

Step six is where duplicates that would have caused an incident get caught. An isolated segment with one unit on it shows the duplicate’s behaviour without letting it interfere with a running machine.

What must stay identical

A common overcorrection is to change everything that looks unit-specific. Some fields must not change:

  • the memory map and the addresses the program expects,
  • the clock configuration and the peripheral initialisation that depends on it,
  • the calibration constants, which are properties of the hardware design and not of the unit,
  • the boot configuration, which decides how the device starts.

The distinction is whether the field describes the unit or describes the design. Address, serial number and installation-specific values describe the unit. Timing, calibration and memory layout describe the design, and changing them breaks the copy.

When the original cannot be read

If the source array is unreadable, the bus capture becomes the primary source of information rather than a supplement. The transmit identifiers, the payload layout, the timing, and the diagnostic behaviour can all be measured from a working unit without touching its flash.

That is enough to build a device that participates in the network correctly, even though it is a reimplementation rather than a copy. For a replacement part on an obsolete machine, that is frequently the actual requirement.

Related reading

FAQ

Does changing the node address break the copy? Only if the program derives other values from it. Change the address and check what depends on it.

Is the serial number always present? Not always. Its absence simplifies the copy and removes one diagnostic discrepancy.

Why does the duplicate produce error frames under load? Usually bit timing from a different oscillator, or a second unit answering the same identifier.

Can the duplicate be tested on the real bus? Better to test on an isolated segment first. A duplicate address on a live machine can cause motion.

Conclusion

The code is the part of a duplicate that is supposed to be identical. The identity is the part that must not be. Capture the bus behaviour, locate the fields that describe the unit rather than the design, change those and only those, and test on a segment where a mistake cannot move anything.

Comments are closed.