Bao'An Shenzhen China

dsPIC Unlock: Code Protection and Recovery Guide

Sep 5, 2026  /  PCB COPY

dspic unlock: dsPIC microcontroller on a circuit board next to ICSP programming header

What Makes dsPIC Different From a Standard PIC or DSP?

Microchip’s dsPIC family sits at the intersection of a microcontroller and a digital signal processor. Devices like the dsPIC30F, dsPIC33F, dsPIC33E and the newer dsPIC33C integrate a 16-bit CPU core with DSP-class multiply-accumulate units, DMA channels and high-speed PWM peripherals. They appear in motor drives, power converters, audio processing boards and industrial sensor front-ends—applications where both real-time control and signal math happen on the same silicon.

Because the architecture blends MCU convenience with DSP throughput, the code protection model borrows elements from both worlds. Understanding how a dsPIC locks its flash is the first step toward any legitimate dsPIC unlock effort, whether the goal is legacy firmware recovery, failure analysis or board-level duplication.

dsPIC Code Protection Architecture

Decapped microcontroller die under microscope with micro-probing needles

Configuration Registers and the FGS / FSEC Words

Every dsPIC stores its security policy inside non-volatile configuration words that are programmed alongside the application firmware. The exact register names vary by family:

  • dsPIC30F — The FGS (General Segment) register contains the GSS and GWRP bits. A separate FSS register can protect a secure code segment.
  • dsPIC33F / dsPIC33E — The FGS register adds finer granularity with GSS1:GSS0 bits, supporting multiple protection levels. Write protection (GWRP) is independent.
  • dsPIC33C — Microchip introduced the FSEC register with a dedicated CSS field and a separate boot-segment security register FBSLIM.

These bits are one-time-programmable in the sense that setting them to the protected state cannot be reversed by a simple register write—only a full device erase clears them, and that erase destroys the firmware along with the protection bits.

Protection Levels Explained

Level Typical Bit Pattern What It Blocks
No Protection GSS = 11 Nothing — full read/write via ICSP
Standard Security GSS = 01 External reads blocked; internal execution allowed; JTAG reads disabled
High Security GSS = 00 All external access blocked; code segment encrypted in some families; bulk erase still possible
Write Protect GWRP = 0 Flash writes blocked but reads may still be open (depends on GSS)

The distinction between Standard and High Security is critical. Standard Security disables ICSP readout but may leave certain debug hooks or boot-segment windows accessible. High Security closes every documented external path, making a dsPIC unlock far more complex.

Secure Code Segment vs. General Segment

Several dsPIC families partition flash into a General Segment and a Secure Segment (sometimes called the Boot Segment in dsPIC33C). Each segment carries its own protection bits. A design may leave the general segment readable while locking the secure segment, or vice versa. Recovery engineers must identify which segment holds the target code before choosing an approach.

Why dsPIC Unlock Is Needed

Legitimate reasons for recovering firmware from a code-protected dsPIC include:

  • End-of-life board repair — The original manufacturer is gone, spare chips are unavailable, and a production line depends on cloning the surviving device. This scenario is common in industrial control board reverse engineering.
  • Failure analysis — A field-returned board must be compared against the golden firmware image to determine whether corruption caused the fault.
  • IP audit — A company suspects its own firmware was copied and needs to read a competitor’s device under legal discovery.
  • Design migration — The original source code was lost, and the only surviving copy of the firmware lives inside a locked dsPIC on a working board.

dsPIC Unlock Methods: From Non-Invasive to Invasive

1. ICSP and JTAG Probing

The first step in any recovery attempt is connecting to the device through its In-Circuit Serial Programming (ICSP) interface or, on families that support it, the JTAG port. If the protection bits were never actually set—something that happens more often than expected—the firmware reads out directly using MPLAB IPE or a compatible programmer.

When Standard Security is active, the ICSP interface still responds to erase commands and device-ID queries, but read commands return all zeros or all ones. Certain early dsPIC30F silicon revisions had erratum-related edge cases where specific command sequences could partially bypass read protection. These were patched in later revisions, so the silicon revision matters.

2. Bootloader and Application-Level Exploits

Many dsPIC designs ship with a user-written bootloader in the boot segment. If the bootloader accepts firmware-upload commands over UART or CAN, it may also accept a read-back command—either intentionally or through a buffer-overflow vulnerability. Recovery engineers analyze the bootloader protocol by monitoring the communication bus during a normal firmware update. If the bootloader code itself is unprotected (General Segment open, Secure Segment locked), disassembling it reveals whether a read path exists.

This approach parallels techniques used in ARM Cortex-M debug port security bypasses, where a bootloader or SWD stub can sometimes be leveraged to extract protected regions.

3. Voltage and Clock Glitching

Fault-injection attacks introduce a brief voltage spike or clock glitch at the exact moment the dsPIC’s protection logic evaluates the GSS bits during a read command. If the glitch causes the security check to return “pass” instead of “fail,” the flash contents flow out through the normal ICSP data path.

Practical considerations:

  • Timing must be precise to within a few nanoseconds, requiring an FPGA-based glitch controller.
  • The dsPIC’s internal voltage regulator on newer families (dsPIC33E, dsPIC33C) dampens external glitches, reducing success rates.
  • Multiple attempts risk corrupting flash, so the chip must often be removed and socketed to allow safe retry.

4. Semi-Invasive Techniques: UV and Laser Fault Injection

Focused UV light or a laser beam directed at the die surface can flip individual bits in the configuration register area. Because the GSS bits are stored in the same flash array as user code, the trick is to target only the configuration word without disturbing the firmware. This requires decapping the package, identifying the configuration word’s physical location using a die map, and applying the beam with micron-level precision.

Semi-invasive work overlaps with the methods described for TI TMS320 and ADI SHARC DSP decryption, where configuration fuses similarly guard readout access.

5. Fully Invasive: Micro-Probing and ROM Extraction

At the most aggressive end, the die is decapped, delayered and imaged under a scanning electron microscope (SEM) or optical profilometer. Flash cell charge states can theoretically be read visually or through micro-probing needles placed directly on the bit-line metal. This is expensive, slow and destructive to the package, but it is the method of last resort when all other paths fail.

Engineers who also need to recover data from peripheral storage on the same board—calibration tables stored in serial EEPROMs, for example—often combine a dsPIC unlock with EEPROM or flash data extraction in a single project.

Family-by-Family dsPIC Unlock Difficulty

Family Flash Technology Protection Granularity Relative Unlock Difficulty
dsPIC30F Older NOR flash General + Secure segments Low to Medium — older process, more susceptible to glitching
dsPIC33FJ Updated NOR flash General + Secure + Boot segments Medium — improved voltage filtering
dsPIC33EP Embedded flash with ECC Multi-level GSS, write protect per segment Medium to High — ECC complicates bit-flip attacks
dsPIC33CK / CH Latest embedded flash FSEC + FBSLIM + secure boot chain High — secure boot verification, tamper detection on some variants

The trend is clear: each generation adds countermeasures. A dsPIC30F6014A at Standard Security may yield to a well-timed voltage glitch in a few hours, while a dsPIC33CK256MP508 at High Security with secure boot may require semi-invasive or fully invasive work.

What Happens After the Firmware Is Extracted?

Raw flash contents come out as a binary or Intel HEX image. Before the firmware is useful, several post-processing steps are necessary:

  1. Disassembly — The binary is loaded into a disassembler (MPLAB or a third-party tool like Ghidra with a dsPIC plugin) to reconstruct the instruction flow.
  2. Peripheral register mapping — SFR addresses are cross-referenced against the device datasheet to identify which peripherals the code configures.
  3. Configuration word extraction — The protection bits, oscillator settings and watchdog configuration are decoded from the last flash page.
  4. Calibration data separation — Many dsPIC applications store motor parameters, filter coefficients or sensor calibration in a dedicated flash page. This data must be preserved separately.
  5. Reprogramming — The cleaned image is written to a fresh dsPIC, and the board is tested. If the target board also needs schematic recovery, a board-level file-set duplication service handles the hardware side.

dsPIC vs. Related Microchip Families

Microchip’s PIC24 shares the same 16-bit core as the dsPIC but lacks the DSP engine. Its code protection registers are nearly identical, so the same unlock techniques generally apply to both. The older PIC18 and PIC16 families use a different bit-level protection scheme; for those devices, the workflow described in our guide to PIC microcontroller code-protect handling is more relevant.

On the programmable-logic side, designs that pair a dsPIC with a CPLD for glue logic may also require CPLD device readback and recovery to capture the complete design.

Practical Tips for dsPIC Unlock Projects

  • Read the errata first. Microchip publishes silicon errata documents for every dsPIC variant. Some errata items affect the protection logic or the ICSP state machine and can open unexpected recovery paths.
  • Identify the exact revision. Die revisions (A1, B2, etc.) differ in their vulnerability to fault injection. A microscope inspection of the package markings or an ICSP device-ID query reveals the revision.
  • Preserve the original chip. If only one sample exists, image the board, photograph the chip markings, and consider whether a non-destructive method should be attempted first.
  • Check external memory. Some dsPIC designs off-load large lookup tables or waveform data to external SPI flash. That data is usually unprotected and can be read independently.
  • Verify after programming. A recovered image should be loaded onto a blank dsPIC and tested on the original board before the project is considered complete.

Legal and Ethical Boundaries

Firmware recovery from a code-protected dsPIC is legal in many jurisdictions when performed by the device owner for repair, interoperability or failure analysis. It may violate intellectual-property law if done to clone a competitor’s product. Always obtain written authorization from the device owner and consult local regulations before beginning a dsPIC unlock project.

Recovery of protected firmware should serve the goal of keeping existing equipment running, not circumventing another party’s design investment.

Conclusion

A dsPIC unlock ranges from straightforward—reading an unprotected chip through ICSP—to highly complex semi-invasive work on the latest dsPIC33C silicon. The key variables are the device family, the silicon revision, the protection level that was programmed, and whether a bootloader or debug stub offers a software-based shortcut. By understanding the configuration registers, matching the right technique to the security level, and handling the recovered binary with proper post-processing, engineers can bring locked dsPIC firmware back to a usable state for legitimate maintenance and analysis.

Working on a board like this?

Send the chip marking or two photos. You get feasibility, lead time and price within 24 hours, and the check costs nothing.

Get a free quote

Related reading

WhatsApp Send board details