Posts Tagged ‘break microcontroller encrypted archive’

PostHeaderIcon Clone Protected GD32F330F8P6TR Program: TSSOP20 64 KB Copy

The GD32F330F8P6TR packs the largest flash of the 20-lead F330 members into a TSSOP20 body: 64 KB of program memory beside a Cortex-M4 core at 84 MHz with 8 KB of SRAM. It is exactly the part you find on a controller board that has outlived its supplier, where the last working firmware exists only inside a locked chip. To clone protected GD32F330F8P6TR program memory the work splits into three stages — reading the original, checking that the read is complete, and producing a donor that behaves identically in the socket.

Decapsulated microcontroller die under recovery

Why this part ends up on the cloning bench

The F8P6TR was chosen by board designers who needed more code space than the 32 KB F6 without moving to a larger package, so it sits in a generation of legacy controllers, drives and metering boards that are still in service today. When the original design house is gone and no archive survives, the only authentic program is the one the microcontroller is guarding. Splicing a similar image from another board almost never works: peripheral initialisation differs between firmware versions, and the result is a board that powers up but does not behave.

Reading the original part

The read protection on the F330 family lives in the option bytes and is evaluated by the flash controller before user code runs, so a standard programmer sees an open port and an empty array. We pass the lock with a timed fault rather than an erase, which leaves the 64 KB intact, then stream the full array out over the debug port. A correct read captures more than the code: the option bytes that record the lock state and device configuration come with it, because a copy that ignores them behaves differently the first time the donor is programmed. Our approach to reading protected arrays is the same one described for general IC firmware recovery.

What a faithful copy has to match

Item Why it matters
64 KB flash image The application itself; one unread block is a dead donor
Option bytes Lock level and configuration the board expects
Vector table integrity A shifted table crashes before main() runs
Data pages Constants and calibration stored in flash, not a separate EEPROM

The F330 has no separate EEPROM on the die or beside it, so anything the board persists lives inside those 64 KB. That is why the read has to be whole-array, not partial. The protection scheme itself is laid out in our overview of flash memory protection methods.

Writing and verifying the donor

A blank F8P6TR takes the image, then the option bytes are written to the state you choose — most owners want the donor left open so this never happens again. After programming we read the donor back and compare the full array against the verified original, byte for byte. Only a complete match counts as a copy.

Where cloning is not the answer

Some jobs are about understanding, not replacement. If the goal is to port or audit the code, the extracted image is better served as a documented disassembly, which is how we approach GD32F330K6U6 source code rebuilds. The smaller GD32F330F6P6TR and the larger GD32F330R8T6 follow the same flow, as do our complete firmware cloning services for other families.

Scoping a clone job

Before a clone is booked we pin down three things: how many donors are needed, whether the donor should be left open or re-locked to the original state, and whether any board-unique trim values must be carried across. Most orders are small — a handful of parts to keep a line running — and the turnaround is days rather than weeks because the read is a single session. Where the board stores calibration in the part’s data pages, those ride along in the image automatically. Sending one surviving board is enough to scope the whole run, and the donor count can be set once the verified binary exists.

What you receive

A clone job returns the donor parts, the verified binary file, and a short report stating the read method, the checksum of both passes, and the option-byte state written to the donor. Send the locked chip or the whole board — both work — and we quote before any bench time starts.

PostHeaderIcon ATtiny24: High-Voltage Entry and What It Can Actually Reach

A fourteen-pin AVR has few pins to spare, and the programming interface needs four of them. When a designer needs one back, the fuse that frees the reset pin is the obvious candidate — and the consequence is a part that no serial programmer can enter.

The escape hatch is high-voltage programming: twelve volts on the reset pin puts the part into a mode where the fuse settings are irrelevant, because the very state that disables serial entry is what the high-voltage mode overrides.

What the mode does and does not do

It does three things:

  • Restores the fuse byte, which is the documented way to undo a disabled serial interface.
  • Reads the signature and the fuse bytes.
  • Performs chip erase.

It does not read protected flash. This is the point that surprises people, and it is worth being blunt about: high-voltage programming on AVR is not a protection bypass. It is an alternate entry path. The lock bits are enforced by the same logic in both modes, and there is no mode in which the part hands over protected contents.

So the high-voltage adapter is a tool for recovering access, not for recovering data. Those are different objectives and they have different prospects.

Why the distinction matters commercially

If a device is locked in mode 2, no interface reads it. If a device is merely unreachable because a fuse disabled the serial port, the high-voltage path restores access and then everything proceeds normally — including, if the lock bits turn out to be clear, a full read.

That means the first question on an unresponsive part is not “is it locked” but “which of the two problems do I have”. They present identically at the programmer: no device detected. They have completely different answers.

Condition Serial entry High-voltage entry Flash readable
Unlocked, fuses normal works works yes
Unlocked, reset pin disabled fails works yes
Locked mode 2, fuses normal works, read refused works, read refused no
Locked mode 2, reset disabled fails works, read refused no

The fourth row is the genuinely closed case, and it is the one a careful designer would choose. The second row is the easy case that looks hard.

Pins are the constraint

On a fourteen-pin part the programming pins are shared with port pins that also carry the ADC and the timer outputs. A product that uses all of them has already made decisions about which function wins.

Two consequences follow. First, the high-voltage adapter needs access to specific pins and a product’s board layout may make that physically awkward — headers may not expose them, and the pins may be loaded by circuitry that interferes with the twelve-volt pulse. Second, the twelve-volt pulse has to reach the reset pin without damaging anything else on that net, which in a product with a reset supervisor means knowing what else is connected.

That is a board-level examination, not a datasheet reading, and it is why a device that is trivial on a breadboard can be awkward in a potting-filled enclosure.

The sequence that wastes least

  1. Power at the design rail, measure at the socket.
  2. Try serial entry. If it works, read signature, fuses, lock byte before anything else.
  3. If serial fails, measure the reset pin while the programmer asserts it. A pin that does not follow means a fuse reassigned it, not that the die is dead.
  4. Move to high-voltage entry only after step 3.
  5. In high-voltage mode, read signature and fuses first. Only then decide about memory.

Step 3 is the one that saves the most time, because it distinguishes a configuration problem from a hardware failure with one probe.

Reading after access is restored

Once in, the small parts behave like every other AVR: page-based flash, byte-based EEPROM, lock bits gating the read commands. The array is small, so a full read is fast and there is no excuse for not reading it twice and comparing.

Two things are worth recording even when the read succeeds: the fuse byte, because it explains the access problem and predicts whether the same device will be reachable again next time, and the signature, because on a fourteen-pin family the members differ only in memory size and a mislabelled part is not unusual.

Related notes

FAQ

Does high-voltage mode bypass the lock bits? No. It bypasses a disabled interface, not code protection.

Can it restore a part whose serial port was disabled? Yes. That is its documented purpose.

Does twelve volts damage the part? Applied to the reset pin in the specified mode, no. Applied elsewhere, yes.

Is a locked, reset-disabled part recoverable? Not by either programming interface. That configuration is closed by design.

Conclusion

High-voltage programming is an entry path, not a key. It restores access that a fuse removed, it reads the fuse byte that explains the situation, and it performs the erase that clears the lock — while destroying the contents. Understanding that narrow scope prevents the most common misallocation of effort on a small AVR.