PostHeaderIcon MSP430G2352: Why a Restored Device Does Not Start

A restored device that does not start produces a strong temptation to re-examine the transfer. The image must be wrong, the read must have been incomplete, the programming must have failed somewhere. In practice the image is usually fine, and the fault is in one of a small number of places that have nothing to do with how the bytes were moved.

The list below is ordered by frequency. Working through it in order takes an hour and eliminates most of the space before any deeper investigation.

First: is it resetting repeatedly

The most common startup failure on this family is not a failure to start. It is a device that starts and resets roughly thirty times a second, which a slow observer sees as nothing happening at all.

The reason is the watchdog. After reset it is running, in watchdog mode, clocked from a source that gives a timeout measured in milliseconds. A program that does not explicitly hold or reconfigure it will be reset before it reaches its main loop, forever.

Observation Interpretation
No activity at all, steady current Device halted or blank
Periodic activity at a few tens of hertz Watchdog reset loop
Activity for a fraction of a second then stop Fault or trap, or a deliberate halt
Activity that never repeats Device entered a low-power mode or hung

The periodic case is diagnosable with a scope on a single pin that the program touches early, or with a supply current measurement that shows a regular pattern.

Second: the reset vector

The reset vector is one word at a fixed high address, and it is the only thing the device reads before it executes anything. If it is wrong, nothing else matters.

Three ways it goes wrong:

  1. The image did not include the vector table, because the linker placed it in a section that was not copied.
  2. The vector was written, but to the wrong endianness or with a byte offset, because the transfer treated the image as bytes rather than as words.
  3. The vector points at an address that was not programmed, which produces execution of erased flash.

Reading the two words at the top of the array and comparing them against the source is a thirty-second check. It should be the first check, not the last.

Third: the clock

A device whose clock is not running behaves like a device with a broken program. The core needs a clock to execute and the flash controller needs one to be read.

Two causes are common after a restoration. The oscillator configuration registers were not copied because they are set by the startup code and the startup code is correct, in which case there is no problem. Or the calibration for the internal oscillator is missing from the information region, in which case the device runs at a frequency far from the intended one.

The second case does not usually prevent a start. It produces a device that runs slowly, which can look like a failure if the program’s first action is a timed wait with a large constant.

Fourth: the supply

Flash programming and flash reading both require the supply to be within specification, and reading is the less forgiving of the two at low voltage.

A restored device tested on a bench supply at the nominal voltage can fail on the product’s own converter if that converter is marginal or slow to rise. The symptom is a device that works when probed and fails when installed, which is the most confusing presentation of the whole list.

Measuring the supply at the device pins during the first milliseconds after power-up, not after it has settled, is the check. A supply that rises slowly through the region where the core is trying to start produces a device that starts sometimes.

Fifth: the reset line

A reset line with the wrong capacitor, or with an external driver holding it, prevents the device from ever leaving reset. The device is powered, the current is normal, and nothing happens.

This is a board fault rather than a restoration fault, and it is the reason a restored device should be tested in a known-good board before the customer’s board is implicated. A device that works in one board and not another has located the fault in the board.

Sixth: the program itself

Only after the five above is the image the suspect. At that point the useful checks are the ones described elsewhere: the vector table pointing into the programmed region, the first instructions disassembling as startup code, the reset vector inside the array.

A specific failure worth knowing: a device whose image was read from a unit that had been in service may contain a state that the program expects to persist — a flag in the information region saying the device is commissioned, a checksum over a parameter block, a counter. Restored into a device without that state, the program takes a branch it never took in the original and stops.

The check is to read the source’s information region as well as its main array, and to compare the two devices’ non-volatile state rather than only their code.

A procedure that finds it in an hour

  1. Scope a pin the program drives early. Classify the behaviour against the table above.
  2. Read the top two words of the array and confirm them against the source.
  3. Measure the supply at the device at power-up, not after.
  4. Confirm the reset line reaches its inactive level.
  5. Try the device in a second, known-good board.
  6. Read the information region of both devices and compare.
  7. Only now re-examine the image.

Steps one and two resolve the majority of cases. Step five resolves the argument about whether the fault is the device or the board, which is otherwise unresolvable through discussion.

Related reading

FAQ

Why does the watchdog cause a reset loop? It is running after reset and times out in milliseconds unless the program holds it.

Can a wrong calibration prevent a start? Rarely. It usually produces a device that runs at the wrong speed.

How do I know the fault is the board? Test the same device in another board.

Is a verified image proof that the restoration is correct? It is proof that the bytes arrived. Everything else is separate.

Conclusion

A restored device that does not start is usually not an image problem. Check for the watchdog loop, check the reset vector, check the clock, check the supply at the device, and test in a second board before doubting the transfer. The order matters more than the depth of each check.

Comments are closed.