PostHeaderIcon ATtiny25: Six Pins, Four of Them Shared With the Programmer

An eight-pin package has six usable I/O pins. The serial programming interface needs four of them, one of which is also the reset line and one of which is also the debug line. There is no spare capacity anywhere, and every design decision on this part is a decision about which function gets a pin.

That constraint is why the programming story on eight-pin parts is more fraught than on larger ones, and why a device can appear completely closed when it is merely busy using its pins for something else.

The four shared pins

Pin Normal use Programming use Conflict
Reset Reset input or I/O Programming enable Anything driving it prevents entry
SCK I/O, clock out Serial clock An external load slows the edge
MISO I/O Data out A driven output fights the programmer
MOSI I/O Data in Same, in the other direction

The conflicts are not hypothetical. A product that drives MISO with another device on the same net will fight the programmer; a product with a capacitor on the reset line for debouncing will prevent entry entirely. Both are common, both are invisible from the schematic’s perspective until someone tries to program the part in circuit.

Why in-circuit programming fails on this part

Three reasons, in order of frequency.

The reset line is loaded. A pull-up is fine. A capacitor to ground is not: the programmer needs to drive the line low and the capacitor holds it, so entry never completes. The fix is to remove the capacitor or program out of circuit.

Another device drives the shared bus. If the pins are shared with an external memory or a second controller, two outputs contend and the programmer reads garbage.

The part is configured for a clock that the board does not supply. A design that runs from an external clock has no clock when the board is powered down for programming.

None of these is a protection problem, and all three produce the same result: no device detected.

What the small array changes

A two-kilobyte flash is 128 pages of sixteen bytes on this member. That granularity is small enough that a full read takes seconds and there is no justification for a single-pass read — reading twice is nearly free, and it removes the entire class of marginal-read errors.

It also means the image is short enough to read by eye in places. A two-kilobyte program has few functions, and strings, if any, are short. On parts this small, manual inspection of the disassembly is genuinely practical in a way it is not on a quarter megabyte.

The lock bits, and what “protected” means here

The four-state encoding applies: unlocked, mode 1 blocking programming only, mode 2 and 3 blocking verification as well. Almost every locked device encountered in the field is in mode 2.

There is no boot section on this family and therefore no second container and no self-programming path. The protection model is exactly one field, which makes the reasoning short: either the array reads, or it does not, and if it does not, the only operation that changes that also destroys the content.

That bluntness is useful. On this part there is no configuration subtlety, no boot fuse interaction, and no partial protection to misread. The question is binary.

The sequence

  1. Supply at the design rail, measured at the socket, with local decoupling.
  2. Attempt entry out of circuit if the board is ambiguous. On an eight-pin part the adapter is trivial to build.
  3. Read signature and fuses. A part configured for a missing crystal will not answer, and this is the fastest way to find out.
  4. Read the array twice and compare. On two kilobytes, this is seconds.
  5. Read the lock byte and record it with the image.

Step 2 is worth the effort on this family specifically because the pin conflicts above are so common. Fighting a loaded reset line for twenty minutes costs more than lifting the part.

What the reading is good for

Six pins and a two-kilobyte program describe a device with a narrow job: a sensor interface, a small controller, a one-function gadget. The firmware is correspondingly small and the behaviour is correspondingly legible.

That makes this family unusually rewarding to examine. The gap between “I have a hex file” and “I understand what this product does” is small, because there is not enough code for the understanding to be lost in.

Related notes

FAQ

Can this part be programmed in circuit? Often yes, but a capacitor on the reset line or a second device on the shared pins will prevent it.

Does the reset pin have to be dedicated? No. It can be an I/O pin, at the cost of serial entry.

Is there a bootloader? No boot section exists, so there is no self-programming path.

How long does a full read take? Seconds. Which is why reading twice is the default rather than an optimisation.

Conclusion

On an eight-pin part, pin scarcity is the dominant fact. It explains why in-circuit programming fails, why a healthy device can look unreachable, and why the reset line deserves a probe before any conclusion is drawn. The memory itself is small and simple; the difficulty is entirely at the socket.

Comments are closed.