PostHeaderIcon PIC12C509 Code: 0x000, 0xFFF, and the Difference That Matters

Two readings from a PIC12C509 can look equally empty in a hex viewer and mean opposite things. One is a part that is protecting 1024 words of real firmware; the other is a part that has never been programmed. Both produce a file that opens, both produce a checksum of some sort, and one of them is worth several thousand dollars of engineering while the other is worth the price of a blank chip.

Break Chip PIC12C509 and extract mcu pic12c509 Code from embedded flash memory, microcontroller pic12c509 memory program will be readout after crack fuse bit by focus ion beam technique

What a protected read actually returns

The code-protect bit lives in the configuration word, which a twelve-bit program counter cannot address and which the programmer reaches with a separate command. Once it is set, the array does not refuse the read and does not return noise. It returns 0x000 for every address in the range. That is a legal instruction word on this core, the no-operation, so a dump of a protected part is a listing of NOPs from the reset vector to the top of memory, at the correct length, with no error reported anywhere.

Why an erased part looks different by exactly one bit pattern

An unprogrammed cell on this process reads as all ones, so a blank check returns 0xFFF. The distinction is a single nibble and it is easy to miss if the tool is only printing addresses and word values without interpretation. It becomes obvious the moment the file is disassembled: 0x000 disassembles to a run of no-operations, and 0xFFF does not disassemble to anything legal at all. A disassembler is therefore a better diagnostic than a hex viewer for this one question.

The check, in the order that saves money

Reading What it is What to do next
0xFFF everywhere Never programmed Discard, buy a blank
0x000 everywhere Protection set, array intact Physical route
Mixed, sensible opcodes Protection clear Verify and deliver
Mixed, but nonsense Wrong part or wrong read clock Re-read

The fourth row is common enough to be worth its own step. A 509 read as a 508, or a read clocked too fast for the internal oscillator, produces plausible-looking mismatches that are mistaken for encryption. The clock question is treated separately in PIC12F508 firmware, and the same test applies here.

What 0x000 tells you about the route

A uniform zero array is good news for the physical route, because it proves the array has not been erased since it was programmed. The protection bit does not clear the cells; it only stops the interface from reporting them. So the die still holds the customer’s code, and any route that reaches the cells directly will read it. What changes is the entry point: the serial programming interface is now a dead end, and the work moves to decapsulation and an optical or electrical read of the array itself.

Where the numbers stop being small

This part is one of the few where an optical read is routine rather than exotic. The cells are large, the array is only 1024 by 12, and the whole image fits in a few passes. That puts the cost of the physical route in the range of a single engineering day, which is why the answer to “is it worth it” is usually yes for a production file and usually no for a hobby project. The same arithmetic on a modern part with eight times the density is a different conversation.

A second read, taken slightly differently

One pass is not proof. Mature practice is to read the array twice with the supply at the low and high ends of the permitted range, then compare. Cells that changed are marginal, and on a part of this age marginal cells are the rule rather than the exception. A uniform zero array is unaffected by the exercise because it is not a measurement of the cells at all, but a file recovered from a cleared protection bit will differ between the two passes, and those differences tell the engineer which words to treat as uncertain when the image is rebuilt.

What to send with the enquiry

Send the reading, not the conclusion. A customer who says the part is protected and a customer who says the read came back empty are describing the same dump, and only one of them has looked at what the words disassemble to. The other habit worth forming is a blank check on a known-good part: two dumps, one protected and one erased, remove the ambiguity for good. When the file is in hand, the packing and verification steps are the ones described in extracting MCU code, and the wider family context is in breaking an IC.

Comments are closed.