Posts Tagged ‘open microchip pic bin’
Open IC PIC16F73 Memory: Opening the Package Is Not the Same Job as Reading the Array
Two verbs get used interchangeably in this trade and they describe different work. Opening is the removal of the package to expose the die. Reading is the extraction of the array, which may happen through the pins, through the die, or through something the designer left behind. A quotation that conflates them is either overpriced or optimistic, and the customer cannot tell which.
The PIC16F73 is a good device to think this through on, because all three situations occur on it in practice. It has 4096 words of flash, 192 bytes of RAM, 22 I/O pins, five analogue inputs, two capture-compare modules, a synchronous serial port, a hardware USART, an eight-level stack and interrupts. It is a general-purpose 28-pin part that turns up in motor drives, chargers, instrumentation and legacy consumer equipment — which means it turns up both protected and unprotected, in working boards and in boxes of loose chips.
The part in numbers
| item | PIC16F73 |
|---|---|
| program memory | 4096 by 14 bits, flash |
| pages | 2, of 2048 words each |
| data RAM | 192 bytes |
| data EEPROM | none |
| I/O | 22 pins |
| analogue | 5 inputs, 8-bit converter |
| serial | one synchronous port, one USART |
| stack | 8 levels |
| protection | code-protect bit, cleared by bulk erase |
The two rows that shape recovery work are the page split and the absence of EEPROM. Four thousand words is the largest array in this family, and crossing the 2048-word boundary is the point where a disassembly stops being a linear sweep. No EEPROM means the settings live in the program array, so a “code only” delivery on this part usually omits something the customer needed.
What opening achieves and what it does not
| situation | does opening help | what actually produces the image |
|---|---|---|
| array unprotected, part on a board | no | the programming interface, in circuit |
| array unprotected, part removed | no | the programming interface, on a fixture |
| array protected, protection known broken by a test mode | sometimes | the interface, after the protection is cleared |
| array protected, no other route | yes | a probe on the die, after opening |
| die damaged, package intact | yes | nothing, and opening proves it |
The second row is where most of the money is wasted. A part that is not protected does not need to be opened, and an eight-level-stack mid-range part with a working serial port is genuinely easy to read on a bench fixture. Sending it to decapsulation adds cost, adds a destroyed package, and adds a week.
The fourth row is where most of the effort goes. When the protect bit is set and the command path is closed, the die is the only route, and then the package has to come off. The opening is a means, not a deliverable.
Three ways to open, and what each preserves
Chemical opening removes the mould compound over the die and leaves the bond wires and the lead frame intact. It is the most informative result and the most sensitive to process control: too little and the die is still covered, too much and the bond pads are gone.
Laser decapping removes compound locally with much better positional control and less chemistry, at the cost of a heat-affected zone around the opening. For a small die the zone can include the pads that matter.
Mechanical approaches work from the backside or remove the package entirely. They are the fallback when the top of the die is not accessible — leadless bodies with no exposed pad, or packages with a die-attach that resists chemistry. They also destroy any chance of reusing the package, which the first two occasionally preserve.
Which method is right depends on the die size, the package and what has to be probed afterwards. That is an engineering judgement made per unit, which is why a supplier quoting a fixed price for “opening” without asking for the package type is guessing.
Reading a four-kilobyte image
Once access exists, the array is 4096 words organised as two pages of 2048, with the page chosen by bits in the program counter latch register. Three checks make an image trustworthy.
The reset vector must decode. On this family the reset address holds a GOTO into the initialisation code, and a first word that is anything else means the read is offset or the die is damaged at the bottom of the map.
The interrupt vector must decode, and the code it jumps to must be consistent with the peripherals the configuration word enables. A USART interrupt vector pointing at a routine that never touches the serial registers is a sign that the two pages were read with the wrong page state.
The page boundary must be checked explicitly. Read word 2047 and word 2048, disassemble both, and confirm that the control flow across the boundary matches the page bits recorded during the read. This one check catches the majority of images that are otherwise plausible.
When opening is the wrong answer
Three situations call for a different decision.
The part is unprotected, in which case read it through the pins and never open it.
The customer has a working board and wants the firmware, in which case an in-circuit read on the assembled board is usually possible if the three programming pins are not committed to other functions — and if they are, removal to a fixture is still cheaper than decapsulation.
The customer has a partial image from an earlier attempt. A second read through the pins is worth doing before opening anything, because a partial image plus a second read often resolves into a complete one: the two reads disagree where the first was marginal and agree where it was good.
For the same question on a part where the data lives outside the program array, PIC16F72 secured data covers the ID locations. For a package-driven view of the same decision, PIC16F506 firmware recovery compares four bodies. And for a part where the array is large enough that address arithmetic itself becomes the problem, ATxmega128A1 heximal reversal takes the next step.
FAQ
Can the part be read without opening it if it is protected? Only if a test mode or a documented unlock exists for that die revision. On this family the protect bit is cleared by a bulk erase, which removes the content, so the answer is normally no.
Does opening the package damage the data? Not the stored charge, but the handling that follows can. A die that is probed while still wet from chemistry gives marginal reads, which is why the read is verified twice.
Is a four-kilobyte image enough to rebuild a product? For the code, yes. For the product, it needs the configuration word as well, because that word decides the clock, the reset behaviour and the protection state of the rebuilt unit.
The short version
Opening and reading are two steps and only one of them is usually necessary. Identify the protection state first, read through the pins whenever the part allows it, and reserve decapsulation for the case where the command path is genuinely closed. Then verify the image at the reset vector, the interrupt vector and the page boundary — three checks that catch nearly every bad read on a four-kilobyte part.