Posts Tagged ‘break protected ic firmware’
PIC12F509 EEPROM: The Programming Pins Are Busy Doing Something Else
Eight pins do not leave room for dedicated programming lines. The two that carry the programming interface are ordinary I/O for the other twenty-nine hours of the day, and in a working product they are usually connected to something: a driver, a switch, a pull-up, or another chip’s enable. Reading such a device in circuit is a contest between the programmer and the firmware.

Two pins, two jobs
One line carries data in both directions and the other carries the clock. In normal operation the same two pins are general purpose I/O that the program may read, write, or leave floating. When the programmer asserts a session, it expects exclusive control: the clock has to be its own, and the data line has to be free to be driven low and released. Anything else is a conflict, and the conflict does not announce itself as a conflict.
What contention looks like from the outside
| Behaviour | Likely cause | What it means |
|---|---|---|
| Programming mode never entered | Data line held by external driver | No session possible |
| Enters, then read aborts | Clock loaded by capacitance or a driver | Marginal timing |
| Read completes with wrong words | Firmware waking and writing the pins | Corruption in the middle |
| Works on the bench, fails in the product | Board loading | Same fault, different fixture |
The third row is the nasty one, because it depends on what the firmware was doing when the session started. If the program is in a sleep loop the pins are idle and the read succeeds; if it happens to be mid-transaction the programmer loses a word or two, and the resulting file is right except in a place nobody looks.
The three ways out
Hold the device in reset for the whole session, so the firmware never runs and never drives the pins. That is the cleanest option where the reset pin is available and not used as an input, which on this part is a configuration choice that has to be checked first. Lift the two programming pins from the board, which guarantees exclusivity and costs a soldering operation and a rework. Or remove the part entirely, which is the option with no remaining unknowns and the highest cost per unit.
What a lifted pin costs
Two pins lifted is a fifteen-minute job on a board with accessible pads and a destructive one on a board with conformal coating. The rework risk is not the lift, it is the reattachment: a pad that lifts with the pin takes the trace with it, and the repair becomes a wire. Photograph before and after, and treat a lifted pin as a documented modification rather than a scratch.
When the board wins
Some assemblies cannot be modified at all: potted, glued, or built on a ceramic substrate where the traces will not survive a soldering iron. In those cases the only path is to power the board normally and attempt the session with the firmware held off by other means, which works when there is a reset line or a supply that can be sequenced. Where neither exists, the answer is that this device cannot be read in place, and the honest quote says so before the customer’s unit is touched.
What the customer should hear
That the read is possible and that the board has to be modified or the part removed to do it. Both are true on almost every product built around this part, and stating them together avoids the sequence where a quote is accepted on the assumption that nothing will be touched and then a desoldering operation turns up in the middle of the schedule. Where the volume justifies it, the better answer is a test fixture: a pair of pogo pins on the programming lines, a way to hold reset, and a documented entry sequence. A fixture turns a fiddly job into a repeatable one and pays for itself on the third unit.
The verification that catches a partial read
Read the array twice and compare. A read corrupted by contention is rarely reproducible, so two passes that disagree localise the problem to the session rather than to the device. Then check that the image disassembles into a coherent program: a file with two wrong words usually still does, which is why the double read matters more than the disassembly. The same reasoning applies to clock faults on the flash sibling in PIC12F508 firmware, and the wider question of what protection does to a read is in PIC12C508 code. Once the file is clean, what happens to it next is the subject of extracting MCU code.