Break Encrypted STM32G473RET6 Program: LQFP64 512 KB Recovery
The STM32G473RET6 puts the full 512 KB of G473 flash into a 10×10 mm LQFP64 package, and this is the part that shows up in the machines people most often need recovered: field-oriented motor drives, servo amplifiers, pump controllers and battery management units. The firmware on those boards is where the tuning lives, the deadband compensation lives and the safety behaviour lives. When the device is the only surviving copy of that tuning, the job is to break encrypted STM32G473RET6 program and get the code out of a part that was sealed deliberately. Note one detail before starting: the G473 has no high-resolution timer, so the motor-control code runs on the three advanced motor-control timers instead, and the CORDIC and FMAC accelerators do the trigonometry the loop needs.
A dense part in a mid-size package
Fifty-two kilobytes of SRAM alongside the 512 KB array, a Cortex-M4 with FPU at 170 MHz and 213 DMIPS, and three FDCAN channels plus USB on a 64-lead body makes the STM32G473RET6 a genuinely capable part in a package that is comfortable to work on. The flash is the ECC-protected dual-bank type with read-while-write, so firmware updates do not interrupt control, and a capture has to record which bank was live at the moment of the read. Three comparators, six op-amps and five ADCs complete a front end that a field-oriented-control loop uses for current sensing.
Ranking what has to be broken
Protection on a sealed G4 unit is layered, so the sensible approach is to list the surfaces in order of commitment and try the cheapest one that preserves the image.
| Surface | Preserves image | Effort | Outcome |
|---|---|---|---|
| SWD at level 0 | n/a | none | Direct read on an open part |
| Bootloader read | n/a | low | Works only if the lock is not set |
| Power or clock glitch | yes | medium | Widens the boot-time check window |
| Optical fault after decap | yes | medium | Precise, repeatable, image intact |
| Microprobing | yes | high | Last resort on a level 2 seal |
Every route except the first two requires physical access to the die, and the aim throughout is to read rather than to unlock. Regressing a level 1 lock to level 0 through the option bytes triggers a mass erase, which destroys the very thing being recovered, so that step is never taken on a part that still holds data. The techniques behind the middle rows are described in our material on power glitches and clock glitch attacks.
The decap route in practice
Chemical decapsulation opens the mould compound over the STM32G473RET6 while the part stays soldered and powered. The die remains live, which is the point: the security decision is made in the first milliseconds after reset, and a precisely timed light pulse against that check makes the verification return the wrong answer for just long enough to open the debug window. The pulse has to land on the security check rather than on control code, otherwise the part misbehaves instead of complying. This is the same principle applied in our decapsulation service.

Getting the program back
Once the port answers, the 512 KB array streams out with ECC correction on marginal cells, and the capture is taken twice so a dropped read is caught rather than delivered. The option bytes come with the image, recording the original lock state and the bank configuration. Analysis then rebuilds the motor-control structure: the current-sense scaling, the Park and Clarke transforms that appear as CORDIC calls, the speed and position loops, and the protection limits, which usually turn out to be the parameters a customer most wants. A flash recovery pass confirms the image is whole, and the reconstruction follows the program restoration routine.
The write-protection map is recorded sector by sector while the array streams out, and delivered with the file, because a region the original refused to erase will also refuse a programming attempt on the replacement, and that failure is hard to interpret without the record. The option bytes are programmed first on a fresh part, ahead of the 512 KB, so the protection state and bank configuration are in place before the code starts and the replacement comes up in the same security state as the donor. The tuning parameters a customer most wants are usually written into a reserved sector rather than the first block, and the reconstruction identifies them by the peripheral addresses they feed.
What you receive
You receive the complete 512 KB flash binary image of the STM32G473RET6, the option bytes, a verification report describing the route used, and a disassembly-based reconstruction of the control code with the tuning parameters identified. The same bench handles the STM32G473QET6 heximal duplicate and the STM32G474RET6 program attack.