PostHeaderIcon Breaking PIC16C717 Protection: Why Calibration Matters as Much as the Code

Most discussions of breaking a microcontroller stop at the moment the image comes out. On a part like the PIC16C717 that is roughly halfway. This device exists to drive things — brushless motors, half-bridge and full-bridge power stages, analog front ends — and firmware written for that purpose carries constants that describe a specific board: deadband delays, current-sense scaling, zero offsets, filter coefficients. Reading the program without reading those constants produces an image that is byte-perfect and functionally useless.

The part in context

The PIC16C717 is a mid-range 8-bit microcontroller with a 10-bit A/D converter, a three-timer set, and an Enhanced Capture/Compare/PWM module. It belongs to the same datasheet family as the PIC16C770 and PIC16C771, which share the core and memory map but differ in converter resolution.

PropertyPIC16C717
Program memory4K × 14 words EPROM
Data memory256 bytes
I/O pins15
Timer modulesTimer0, Timer1, Timer2
PWMEnhanced CCP with deadband delay
A/D converter10-bit
ReferenceOn-chip bandgap
SerialMSSP — SPI and I²C (master mode)
SupervisionProgrammable brown-out reset, low-voltage detect
Supply2.5 V – 5.5 V

What the peripheral set tells you about the firmware

The enhanced PWM module is the diagnostic clue. Half-bridge and full-bridge output modes with a digitally programmable deadband delay exist for one reason: driving power transistors without shoot-through. A part configured this way is almost certainly running a motor or a switching converter.

That has direct consequences for recovery. A deadband value is not a fixed architectural constant — it is chosen against the gate drive and the transistor turn-off time of a particular board, and it lives in the firmware as a programmed register value. Likewise a 10-bit converter with a bandgap reference means the firmware contains scaling that converts raw counts to engineering units, and those scale factors are calibrated per product, sometimes per unit.

So the practical sequence for a usable rebuild is:

  1. Recover the program array.
  2. Recover the configuration word, which fixes the oscillator mode and the protection state.
  3. Locate and preserve the calibration block — deadband, A/D scaling, offset and gain terms, any filter coefficients.
  4. Verify on real hardware against measurement, not against a checksum.

Step three is where rebuilds fail. A clone that carries the wrong deadband value will run, will drive the bridge, and will eventually destroy it.

Memory organisation and the recovery implications

Break MCU PIC16C717 Program
Break MCU PIC16C717 Program

The PIC16C717 uses the standard mid-range arrangement: a 13-bit program counter addressing an 8K × 14 space with 4K implemented, reset at 0000h, interrupt at 0004h. Data memory is banked in 128-byte blocks with Special Function Registers at the low addresses of each bank, and high-use SFRs mirrored between banks.

Two features of this particular device affect what a recovered image looks like.

Program Memory Read. The part supports reading its own program memory through table operations, which is how the compiler places look-up tables, character strings, and sensor linearisation data directly in flash. Those tables are part of the design, not padding, and any read that truncates the tail of the array loses them.

The bandgap reference. With an on-chip absolute reference available, firmware often calibrates against it rather than against VDD. A recovered image therefore contains the constants that make that calibration work, and they must be preserved verbatim rather than regenerated.

How protection works

Code protection on this device is a configuration bit that prevents read-out of program memory through the programming interface, including in-circuit serial programming. As on the rest of the mid-range family, the configuration word shares the EPROM array with the program, so there is no documented operation that clears the bit and preserves the code — a windowed part loses both to ultraviolet erase, and an OTP part has no erase path at all.

Beyond the documented route, the approaches are the established families: a precisely timed disturbance that causes the protection check to be mis-evaluated during a read attempt, or physical access to the floating-gate cells after decapsulation. The first is non-destructive and revision-sensitive; the second is reliable and destroys the package.

Related parts show the same constraints at neighbouring sizes and resolutions — PIC16C716 hex image recovery for the smaller EPROM part, and PIC16C770 EEPROM recovery and PIC16C771 firmware for the family variants with different converter resolutions.

Why a locked PIC16C717 is a common case

This part was chosen in designs where an analog loop needed digital supervision: motor drives, power supplies, instrumentation front ends. Those products have long service lives, and the firmware is frequently the only surviving description of the control loop — the schematic shows the bridge and the sense resistor, but not the deadband, not the current limit, not the ramp.

Because these designs are safety-relevant, the stakes of a bad rebuild are higher than on a display controller. A clone with an incorrect deadband will appear to work in a bench test and fail in the field, which is why verification against instrumentation is not optional.

Limits worth stating upfront

  • Calibration is part of the design. An image without the constants behind the PWM and A/D scaling is not a working program.
  • OTP devices are single-attempt. There is no erase to fall back on after an invasive route.
  • Ten-bit resolution is unforgiving. Small errors in the recovered scaling produce large errors in the controlled variable.
  • Revision differences affect fault-injection results. Behaviour is not uniform across silicon revisions.

FAQ

Does code protection prevent in-circuit programming as well as reading? It prevents read-out. Programming a blank device and reading a protected one are different operations, and only the second is blocked.

Why does the enhanced PWM module matter for recovery? Because its configuration values — deadband in particular — are board-specific firmware constants. Recovering the instruction stream without them yields a program that compiles and misbehaves.

Can the calibration block be regenerated instead of recovered? In principle, by re-deriving it on the target hardware. In practice that means re-characterising the product, which is usually a larger effort than recovering the data.

Is the on-chip bandgap reference stored in firmware? The reference itself is hardware. The constants that use it for calibration are firmware, and those are what must be preserved.

Conclusion

Breaking the protection on a PIC16C717 is the entry condition, not the finish line. What makes this part distinctive is that its peripheral set — enhanced PWM with deadband, a ten-bit converter against a bandgap reference — guarantees the firmware holds board-specific calibration. The protection bit is one barrier; the calibration data is the second, and it is the one that decides whether a recovered image is a working controller or a plausible-looking file.

Comments are closed.