Posts Tagged ‘reverse microchip mcu flash’
Reverse PIC16LF77 protected flash memory
A request to reverse PIC16LF77 protected flash memory begins with the fact that PIC16LF77 carries 8K words of 14-bit flash program memory and 368 bytes of data RAM and runs at 20 MHz in a 40-pin PDIP / 44-lead PLCC body. The work starts with the configuration word, because a mid-range PIC16 protects its program array with a single code-protect bit rather than a bank of lock bits.

how to reverse PIC16LF77 protected flash memory without losing the array
This PIC16 family uses a 14-bit instruction word and a single configuration word mapped at address 0x2007, outside the user program space and reachable only in programming mode. The code-protection bit, named CP0 on the larger members of this group and CP on the smaller flash parts, is the whole of the read-out control: left unprogrammed it allows normal reads, and programmed it protects the entire program array at once. ID locations and the configuration word itself remain readable even when the array is protected, which is why the first bench step is a read of 0x2007.
the PIC16LF77 memory geometry and its protection cost
On the PIC16LF77 the program array holds 8K words of 14 bits, with 368 bytes of data RAM beside it and no data EEPROM on this member. There is no separate boot section and no separate data array to preserve, so the geometry question is simply how many words the programmer must return. Once code protection is enabled every program-memory location reads back as zeros and further programming of the array is disabled, while the ID locations and the configuration word still respond. The 40-pin PDIP / 44-lead PLCC body with 40 pins changes only the lead frame; the word count is fixed by the device number, not by the package suffix.
| PIC16LF77 recovery geometry | Value |
|---|---|
| Program memory | 8K x 14-bit words of flash |
| Data EEPROM | no data EEPROM on this member |
| Data RAM | 368 bytes |
| Core and clock | 14-bit PIC16 core at 20 MHz |
| Protection | CP code-protect bit in the 0x2007 configuration word |
| Package | 40-pin PDIP / 44-lead PLCC, 40 pins |
reading the PIC16LF77 over the programming interface
In-circuit serial programming reaches the part over the clock and data pins with the programming voltage applied to the reset pin, and the same path reads the configuration word and the ID locations. What fails under an active code-protect bit is the array read: a verification pass returns zeros from every program-memory location while the part continues to execute its firmware normally. Disabling code protection is not a non-destructive unlock. The programming specification requires a chip erase command, which erases the program memory first and then the configuration memory, and in doing so clears the code-protect bit back to the unprotected state. The practical routes are therefore a clean read while CP is off, or an erase that the customer must approve in writing because it removes the program along with the protection.
when a reverse PIC16LF77 protected flash memory job needs an authorised erase
Read the configuration word at 0x2007 first and check the code-protect bit, because that single bit settles whether any firmware can be read at all. With protection off the array reads cleanly and the heximal can be assembled directly from the returned words. With protection on there is no partial read and no selective block to keep, so the only route to a blank device is the chip erase with its permanent cost. The PIC16LF77 is the 8K words of 14-bit program memory device in a 40-pin PDIP / 44-lead PLCC body, so the capacity marking and the package settle the array size before anything is priced. The low-voltage LF grade with the larger program array is the identifying trait here. What survives the protection: the configuration word, the ID locations, the device ID word at 0x2006 and the register contents the running firmware exposes.
identifying the PIC16LF77 against its siblings
When a board carries only a partial marking, the mid-range PIC16 flash family is the place to look, because its members share the 14-bit core, the 0x2007 configuration word and the same code-protect behaviour while differing in program words, RAM, pin count and peripherals such as the ADC and the capture compare module. Neighbouring members span 2K to 8K words of program memory in 18-pin to 40-pin bodies, all using the same 14-bit core and the same single code-protect bit, with no data EEPROM anywhere in this group. Reading the device ID word at 0x2006 against the package marking settles which member is on the board before any protection work begins.
The same read-first routine appears in attack chip dspic33fj256gp506a software, attack chip pic16c622a software, attack chip pic16c73a program and attack chip pic16f72 heximal, with attack chip pic18f66k90 software showing how the larger array changes the pricing.
the deliverable for a reverse PIC16LF77 protected flash memory request
For a board that arrived as a reverse PIC16LF77 protected flash memory request, the deliverable is a confirmed word count, a code-protect state and a priced route agreed in writing before any destructive step, and our engineers read the configuration word at 0x2007 first.
PIC16F77 Flash: Watching the Bus Instead of Reading the Array
Not every question about a microcontroller is a question about its bits. The PIC16F77 is a forty-pin part with eight thousand words of flash and one feature its smaller relatives lack: a port that can be configured as a parallel slave, so the device can sit on an eight-bit bus as a peripheral rather than being the only processor in the design. Where a product uses that, there is a second way to learn what the firmware does.

Why the pins change the question
A design that puts this part on a host bus has already solved the observability problem for you. Address lines, data lines and strobes are physical signals on the board, at logic levels, in a protocol that the host drives. Clipping a logic analyser to them records the conversation between the two processors, and that conversation is the interface specification of the firmware in the only form that matters: what it accepts, what it returns, and in what order.
What the slave port exposes
The port presents an eight-bit data register with control lines for read, write and chip select, and the device’s program sees each transaction as a byte arriving or leaving. From outside, that means every value the host sends is visible, and every value the device returns is visible, along with the timing. What is not visible is the code that produced the response, or anything the device does when the host is not talking to it.
What the host already knows
The other processor in the product is usually documented, and its side of the protocol may exist as a data sheet with register names. That turns a capture into a decode: the host writes a command byte, then a parameter, then reads a status byte, and each of those fields has a name on the host side. Starting from the host’s documentation and confirming it with the bus is far faster than reverse engineering the protocol from timing alone, and it produces a specification that can be handed to whoever writes the replacement.
Timing that identifies the build
Strobe timing carries information that the values do not. The number of instruction cycles between a request and a response reflects the code path taken, so two units with different firmware revisions show different latencies for the same command. On a product with several field updates, that difference is how a capture can be attributed to a specific build, which matters when the customer needs to know which version the recovered behaviour corresponds to.
Observation is not extraction
| Question | Array read answers | Bus capture answers |
|---|---|---|
| What exact instructions run | Yes | No |
| What the device accepts | Partially | Yes |
| What it returns and when | Partially | Yes |
| How it behaves when idle | No | Only if the bus is quiet |
The first row is the one to be honest about. A capture is a specification of behaviour, not an image of code, and a second unit built to a specification will match on the paths that were exercised and diverge everywhere else. That is the same gap that separates a bit copy from a behavioural rebuild in copying a microcontroller, and it is wider than it looks from the outside.
What a capture does prove
It proves the protocol, the timing and the values, which is often enough to write a replacement that satisfies the host. It also proves which byte positions are meaningful, which is useful when the EEPROM image has to be decoded and the field layout is unknown. And it produces a test vector set: replay the capture against the replacement and the divergence is visible immediately, which is the only kind of acceptance test that means anything.
When this is the right tool
When the device still runs, when the product has a host bus, and when the customer needs a compatible replacement rather than the original source. It is also the right tool when the array is protected and the die-level route is refused on cost, because it produces something usable for a fraction of the price of an extraction, as long as the scope is stated honestly at the start.
The limit worth saying out loud
A capture cannot recover the firmware, and no amount of analysis turns it into one. If the customer’s real need is to modify the code, or to manufacture identical units, the bus is the wrong instrument and the answer is the array. The distinction between the two is what separates a working replacement from a copy, and it is the same distinction that makes PIC16F76 a code-reading problem rather than a bus problem. Where the data rather than the program is the target, PIC16F74 data sets out the two locks involved.