Posts Tagged ‘decap ic software’
STM32G030F6: Where the Security Bits Went
The phrase “security bits” comes from a generation of small microcontrollers where protection was literally one bit, sometimes one fuse, with two or three meaningful states. Engineers who worked with those parts still use the phrase, and it still gets typed into search boxes, but the thing it refers to no longer exists in that form.
On a modern ARM part the protection is a block of option bytes — a small non-volatile configuration area with several independent fields, one of which happens to encode a protection level. Calling them “bits” is harmless. Treating them as one bit is how devices get destroyed.
One word, four different mechanisms
When a customer says the chip is “locked”, they may mean any of four things, and the four have different answers.
| Mechanism | What it protects | What it stops | Reversible |
|---|---|---|---|
| Read protection level | The whole flash array | Debug reads, bootloader reads | Level 1 yes, level 2 no |
| Write protection | Selected pages | Accidental erase or programming | Yes, by option byte change |
| Securable area | A small region at the start | Reads and writes even from running code | Yes, with a full option reload |
| Boot configuration | Where execution starts | Nothing directly, but changes access | Yes |
Read protection is the one that matters for recovery, and it is the only one of the four that is a level rather than a flag.
Read protection has three states
Level zero is unprotected. The debug port can read the array directly, the ROM bootloader will hand over memory, and there is nothing to defeat.
Level one is protected. The debug port still connects, the core still runs, and every attempt to read flash through the debug interface returns either an error or meaningless data. What level one does not do is stop the code that is already in flash from reading it — the application can read its own constants freely, because it is not going through the debug port.
Level two is permanent. Debug access is disabled at the silicon level, the option bytes can no longer be changed, and there is no documented path back. A device at level two is not a recovery target by any software route.
The distinction between level one and level two is the single most important fact in this work, because the operation that “opens” a level one device also erases it, and the operation that attempts to open a level two device does nothing at all.
Write protection is not protection against reading
A frequent confusion: a device with write protection enabled is reported as “protected”, and it is — against modification. The array reads normally. If the goal is extraction, write protection is irrelevant, and mistaking it for read protection sends the job down a route that was never blocked.
The two are configured in the same option byte block, which is why they get conflated. They are evaluated by different logic and they answer different questions.
The small package does not simplify anything
The twenty-pin variant has the same protection hardware as its larger siblings. What it has less of is pins, and that changes the practical route rather than the protection.
With fewer pins, the debug interface shares signals with functions the application wants, and a product built around this package usually has very little board space for a probe. The result is that the electrical access is the harder half of the job, while the protection is the same puzzle as on a forty-eight pin part.
It also means a smaller array: at this flash size the entire image is a few dozen pages, and a full read is a matter of seconds once access exists.
Reading the option bytes first
Before any decision, read the option byte block and the status register that reports the current protection state. This costs one command and it prevents two expensive mistakes: attempting a read that was always going to fail, and issuing an unlock on a device that is already open.
The fields to record, in the order that matters:
- The read protection byte and therefore the level.
- The write protection bits, mapped to the pages they cover.
- The boot configuration, which decides where execution starts and whether a bootloader is in the path.
- The securable area size, if the option is present on this revision.
Record the raw values and the interpretation together. The interpretation is what you will check against behaviour later, and the raw value is what has to be programmed back.
What level one actually allows
Level one blocks the debug port from reading flash. It does not block:
- Execution of the existing code, which is how the device still works normally.
- Communication over the application’s own interfaces.
- Reads of memory that is not flash, within the limits the debug port imposes.
- Identification, which means the part number and the revision remain readable.
That last point is why a locked device can still be identified, and why the first question — which part is this — has an answer even before protection is considered.
The mistake to avoid
The unlock sequence for level one is documented and it works. It also erases the main flash as a security measure, which is the entire point: the protection is removed by removing what it protected.
So “opening” a protected device is not a recovery technique. It is a way to obtain a blank part. Any procedure that begins with an unlock has already decided to destroy the contents, and that decision belongs to the device owner, in writing, before it is executed.
Related reading
- STM32G030C8 and what opening the protection actually costs — the same mechanism, from the side of the operation rather than the map.
- STM32G030K8 and where the code physically lives — the read path once access exists.
- STM32F030C8 read-out protection — the predecessor family, where the same levels behave slightly differently.
FAQ
How many security bits does this part have? Not one. The protection is a set of option byte fields, of which the read protection byte is the only one that carries a level.
Can a level one device be read without unlocking? Not through the debug port. Other routes depend on what the application itself exposes.
Is level two ever recoverable? No documented method exists. A level two device is treated as unrecoverable through software.
Does the twenty-pin package protect differently? The mechanism is identical. Only the physical access differs.
Conclusion
The word survived the architecture that produced it. What exists now is a block of option bytes with one field that encodes a level, and the level determines everything: what can be read, what must be destroyed to change it, and whether the device is a recovery target at all. Read the block before doing anything, and treat the word “unlock” as a synonym for “erase” until proven otherwise.
PIC16C55 EEPROM: Why a Wide Die Is Opened for a Probe
Opening a package is a means, and on the PIC16C55 the end is usually electrical rather than optical. The part carries the same 512 words of twelve-bit program memory as its smaller relative, but it puts them on a die sized for 28 pins, and the extra area is mostly room: room for bond pads, room for bus routing, room to land a probe without touching anything that matters.

A wide die is mostly periphery
Port expansion is not free in silicon, but it is cheap in area at this process node. The array stays the same size while the pad ring and the I/O logic grow, so a part built for 28 pins has generous spacing between the array and the edge. Every one of those pins has a driver, and every driver is fed by a bus that has to come from somewhere. When the array is protected, those buses are the next best thing to the array itself, because they carry what the array contains.
Why a probe beats a microscope here
An optical read is a per-cell measurement: one image per block, one classification per cell, and a stitching exercise afterwards. A probe read is a bus transaction: address on one set of lines, data on another, clock it and capture. On a die this size the pads are large enough to land on with a mechanical probe station, and the address and data paths are wide and slow by later standards, which means a capture does not need heroic timing. The result is the image with far less interpretation and a correspondingly smaller chance of a bit error.
The lines worth finding
| Signal group | Where it lives | Why it helps |
|---|---|---|
| Program address | Between PC logic and array | Tells you where the read is |
| Program data | Array output latches | The word itself |
| Instruction clock | Near the oscillator block | Gives you a capture trigger |
| Reset and MCLR | Edge of the pad ring | Repeatable start point |
The third row is the one that makes the work practical. Without a stable trigger the capture is a guess about alignment; with the instruction clock brought out to a pad, every fetch has a known boundary and the data lines can be sampled in the middle of their valid window.
Decap for a probe is not decap for a photo
The two jobs want different things from the opening. A photographic read wants the array clean, flat and free of any residue that would scatter light, which pushes towards a wide opening and a careful final clean. A probe read wants the bond pads exposed and the surface mechanically stable enough to take a touchdown, which pushes towards a narrower opening that leaves the passivation over the array intact. Doing both in one pass is possible and is usually a compromise: the pads get contaminated by the etch, or the array gets scratched by the probe.
The risks that decide the schedule
Mechanical contact is the obvious one and the least common. More often the damage is chemical: an etch that runs a few seconds long undercuts the passivation near the pad ring and lifts the metal that the probe is supposed to land on. The second risk is static, which on a part of this age is a real failure mode and not a formality. Both are reasons to open a spare unit first when one exists, and to accept that a single-unit job has no rehearsal.
The read that comes after
A probe capture is not a file. It is a stream sampled off the bus, with the alignment decided by the trigger and the word boundary decided by the address lines, and it has to be reconciled against the memory map before anyone calls it a program. The reconciliation is cheap: if the capture is right, the words disassemble into an instruction stream that runs to the reset vector and back. If it is wrong, the disassembly shows the same instruction repeating at a period equal to the misalignment, which is a distinctive failure and an easy one to correct.
When this is the right call
It is the right call when the array is protected, the die is large, and the customer needs a bit-exact image rather than a functional rebuild. It is the wrong call when the protection is clear, because a pin-level read costs minutes, and it is the wrong call when the part is a plastic OTP with the same die as an 18-pin sibling, where the smaller die is cheaper to work. The comparison to the 54A is in decap of the 54A and the smaller package variant in PIC16C58B; the technique itself belongs to the wider family described in attacking an MCU.
PIC16C54A Hex File: Counting Metal Layers Before the Cells Appear
Every decapsulation conversation eventually arrives at the same question, and it is not about acid. It is about how many layers of metal sit between the outside world and the floating gates. On a PIC16C54A the answer is one, and that single number changes the job from a multi-day delayer into an afternoon of selective etching.

Why the layer count comes first
A modern microcontroller stacks four to eight metal layers over the array, and each one has to come off without touching the layer below, because the array is only visible when nothing reflective is above it. That is the expensive part of the work: not opening the package, which is routine, but removing interconnect uniformly across a die whose topography was never designed to be opened. A part from the early single-metal era has none of that. Remove the passivation and the polysilicon floating gates are already the topographical feature you are looking at.
What this particular die gives you
The process is a coarse one by any later standard, with cell dimensions measured in whole microns and a program array of only 512 words by 12 bits. Large cells mean strong contrast under an optical microscope, and strong contrast means a bit can be classified from a single image rather than from a stack of them. The 18-pin package is also helpful in a mundane way: the die is small, the bond wires are short, and there is plenty of room around the cavity to work.
Where the etch stops, and why
| Layer | What it is | Does it have to go |
|---|---|---|
| Epoxy body | Package | Yes, entirely |
| Passivation | Glass over the die | Yes, over the array |
| Metal 1 | Interconnect | No, there is nothing above it |
| Polysilicon | Floating gates | No, this is the signal |
The third row is the point. On a multi-metal part the interconnect sits above the cells and must be removed; here the interconnect is coplanar with what you want to see, and in most layouts it does not cross the array at all because the array is a regular block that the designer routed around.
Reading 512 words by eye
The array is small enough that a full read is a matter of a few dozen images and a stitching step. Each cell’s threshold state maps to a brightness, the brightness maps to a bit, and twelve bits make a word. The labour is in the bookkeeping, not the imaging, and the check is arithmetic: the reconstructed image should disassemble into instructions that make sense as a program. A block of cells that decodes to a plausible instruction stream is strong evidence the bit classification is right; a block that decodes to nonsense means the polarity or the word boundary is wrong.
What the hex file will not contain
Unlike the eight-pin parts, this one has no factory calibration word in the array. Its oscillator is either an external crystal or an RC network with an external resistor, so there is no per-die trim value to recover and nothing at the top of memory that behaves differently from code. What is missing instead is the configuration word, which on a twelve-bit core is outside the program counter’s reach and is programmed by a separate command. A file that stops at the last program word is complete as code and incomplete as a device description, and the difference shows up when the image is used to build a second unit rather than to read the first.
The one failure that ends the job
Etch past the passivation and the same chemistry starts on the aluminium that the bond wires are welded to. It happens quietly, because the die still looks intact from above while the weld has been undercut, and it is discovered when a probe touchdown lifts a pad and takes the wire with it. There is no recovery from that, which is why an etch on a single-unit job is timed conservatively and inspected between steps rather than run to a schedule taken from a different die.
What the deliverable looks like
A hex file in the ordinary sense, plus a note listing the configuration word, the polarity assumed for the optical classification, and the checksum of the reconstructed image. The note matters more than usual here because the read was made by eye: a reviewer needs to know which words were certain and which were inferred from a single marginal image. Where the die is too degraded for optics, the electrical alternative is the one described in probing the wider 55, and the general constraints are in breaking an IC. Format and verification follow extracting MCU code.