Posts Tagged ‘recover mcu source hex’

PostHeaderIcon ATtiny45V: Matching Programmer Levels and Clock to a 1.8 V Target

The V suffix is not a marketing label. It marks a part specified down to 1.8 V, and the price of that lower floor is a lower ceiling on clock frequency at the bottom of the range. Both figures move together, and both of them decide whether a programmer that works perfectly on an ordinary ATtiny45 will work at all on an ATtiny45V.

The practical consequence is a failure mode that misleads almost everyone the first time. The adapter reports no device, or a signature of 0x00 0x00 0x00, and the natural conclusion is a dead chip or an enabled lock bit. Most of the time it is neither. It is a level or a clock that the target cannot accept.

What the V suffix changes

The non-V part is specified from 2.7 V to 5.5 V and reaches its top speed at 5 V. The V part extends the bottom of the range to 1.8 V, but the maximum frequency falls as the supply falls: a device running at 1.8 V cannot be clocked at the rate it manages at 5 V. That is a silicon property of the process, not a documentation quirk, and it applies to every member of the family.

For a recovery the important part is not the headline speed. It is that a 1.8 V design is a 1.8 V design all the way through: a coin cell, a lithium primary, two alkaline cells. Those boards are built to run at the bottom of the range, and everything attached to them, including the programming header, was chosen with that in mind.

Failure one: the programmer supplies 5 V

Most bench programmers source target power, and most of them source 5 V, because that is what the parts they were designed around wanted. Connecting one to a board whose rail is 1.8 V creates a conflict between two supplies with no arbitration. The current that flows depends entirely on the board, and the outcomes range from harmless to destructive:

  • the programmer’s 5 V back-feeds the board’s regulator, which may survive, may clamp, or may not;
  • the board’s rail is dragged up toward 5 V, and every other device on it is now over its absolute maximum;
  • the target runs, the interface works, and the damage is done quietly to something else on the same rail.

The safe arrangement is to power the target from its own supply and connect only ground plus the four interface lines, then confirm that the programmer is not driving its own VCC onto the header. Many adapters do this through a jumper that is easy to leave in place.

Failure two: the levels do not meet

Even with the supplies separated, the signal levels have to be compatible. A programmer driving 5 V logic highs into a target running at 1.8 V presents the target’s pins with a voltage above their absolute maximum rating. Some parts tolerate it briefly, some latch up, and none of them are specified to.

The reverse direction fails differently. The target’s 1.8 V high may sit below the programmer’s input threshold, so the programmer reads every response bit as a zero. That produces a signature read of all zeros, which is precisely the result an operator interprets as «protected».

A level translator solves both directions, and a programmer with a variable supply solves them more simply. What does not solve them is trying harder with the same cable.

Failure three: the interface clock is too fast

The serial programming interface has a hard rule: its clock must be no faster than a quarter of the target’s operating clock. The rule exists because the interface is sampled by the target’s own clock, and the target must be able to see each edge.

Here the V part has two compounding problems. The internal oscillator is divided down at reset by a fuse that ships enabled, so a factory-fresh device runs at a nominal 1 MHz rather than the 8 MHz the oscillator produces. A quarter of that is 250 kHz. Programmers commonly default to a much faster rate because it works on parts running at 8 or 16 MHz, and on a fresh V part it does not work at all.

target clock maximum interface clock typical programmer default
1 MHz (factory divide enabled) 250 kHz too fast
8 MHz (divide disabled) 2 MHz usually fine
128 kHz (internal low-power oscillator) 32 kHz far too fast

The 128 kHz row is the one that ends arguments. A design that runs from the low-power watchdog oscillator has an interface ceiling of 32 kHz, which is slow enough that some adapters cannot go that low and the job has to be done with a different tool.

Establishing the target clock independently

Because the interface speed is derived from a clock that cannot be read from outside, it has to be inferred. Three sources agree often enough to be trusted:

  1. The fuse read, if it can be obtained at all, says whether the divide-by-eight is enabled.
  2. The board itself says a great deal: a crystal or resonator sets the clock, and its absence points at an internal oscillator.
  3. The firmware’s timing loops say the rest. A delay loop calibrated for 1 MHz and one calibrated for 8 MHz differ by a factor of eight in their constants, and that ratio is visible in the disassembly once the image is out.

That last route is the reason the clock question is not blocking. It is answered after the read rather than before it, and it is recorded in the report so the next person does not have to rederive it.

What is actually being delivered

A program-level recovery on this variant returns the flash image, the EEPROM as a separate file, the fuse and lock bytes as read, a disassembly with the peripheral registers annotated, and a note stating the supply range and the clock the image was built for. That note is the difference between an image that gets reflashed successfully and one that appears to work on the bench and fails in the field, because a build compiled for 8 MHz does not keep time on a board that runs at 1 MHz.

Protection itself is unchanged from the rest of the family; the two lock settings behave the same way as on the non-V part. The low-voltage variant simply adds two constraints before any of that becomes reachable. The non-V part’s constraints are covered in ATtiny45 heximal extraction, and the EEPROM behaviour under erase in ATtiny85V software recovery.

The same clock question reappears on much larger arrays, where a design that assumes one frequency and runs at another breaks serial timing rather than a delay loop; ATmega1280V program recovery covers that case.

FAQ

Will a 5 V programmer damage an ATtiny45V? It can, and it can also damage everything else sharing the rail. Separating the supplies is the fix, not lowering the programmer’s current limit.

Why does the signature read as all zeros? All zeros is what a programmer reports when it receives no valid response, which points at levels or clock rather than at protection.

Can the interface clock be raised after the first successful read? Yes. Once the read works, speed is a convenience. Before it works, speed is the variable to reduce.

Conclusion

Two numbers decide whether a low-voltage part can be read at all: the voltage the programmer presents and the rate at which it toggles the interface clock. Neither is visible in the failure, which is why the failure is so often attributed to the lock bits. Set the levels to the target’s rail, drop the interface clock below a quarter of the target’s clock, and most «dead» V parts answer normally.