Posts Tagged ‘recover mcu embedded software’

PostHeaderIcon Recovery MCU PIC12CE673 Flash: Sixteen Bytes That Were Never Secret

There is a part of this device that protection does not cover, because it was not designed to be covered. The sixteen bytes of data EEPROM are reachable through two pins by an external master, independent of whether the processor is running and independent of the code protection state. That is a deliberate feature of the CE family, and it divides the device’s content into two classes that need to be treated differently.

The PIC12CE673 is an eight-pin OTP part with a thousand words of program memory, sixteen bytes of data EEPROM, and a small analogue front end. It was designed for products that need a few bytes of non-volatile data without an external memory device: calibration constants, a serial number, a set of limits, a simple pairing value.

The two regions

Region Access Protection applies Who can read it
program array programming interface yes an authorised programmer
data EEPROM two-wire interface from outside no, by design anyone with a bus master and power

The second row is not an oversight. The EEPROM exists so that a production fixture or a service tool can read and write the unit-specific values without entering programming mode, and that convenience requires an external interface.

The consequence is a security model that most designs of this era did not articulate: the sixteen bytes are public. Anything stored there should be assumed known to anyone who can reach the pins.

What gets stored there, and what should not

Content Appropriate Why
calibration offsets yes useless without the product
serial number yes identity, not a secret
operating limits yes configuration, not a secret
a pairing key risky readable by anyone with a bus master
a customer password no it will be extracted in minutes
a rolling counter yes, with care readable, but still useful as state

The fifth row is where products get into trouble. A design that stores a user password in this array has a password that can be read out with two wires, and the only thing protecting it is that nobody has bothered. This is worth saying plainly to a customer who is recovering a design in order to continue manufacturing it: the security property they believe they have may not exist.

The recovery advantage

From the other side, the same feature is a gift. On a device whose processor no longer runs, the EEPROM may still be readable, because the interface logic does not depend on the core executing code.

Three conditions make the attempt worthwhile. The device must be powered within its operating range from an external supply. The rest of the board must be isolated so that the product’s own circuits do not drive the two pins. And the access must be slow enough for the device to respond — a two-wire interface at a conservative clock rate is more reliable than a fast one on a part of this age.

If it works, the result is sixteen bytes and proof that at least part of the die is alive, which changes the assessment of the program array: a die that answers on the EEPROM interface is a die worth reading, not a dead part.

What the program array contributes

The program array on this part is a thousand words, which is small enough that the reading is quick and the analysis is thorough. Two features of the code are worth extracting specifically because they explain the EEPROM.

The first is the routine that reads a value from the EEPROM into RAM. Its address constants identify which of the sixteen bytes hold what. The second is the routine that writes, which on a production unit is often gated by a flag so that it runs once.

Code feature What it establishes
EEPROM read routine which slots are used, and their order
write gating whether the values are written at production or in service
bounds checks the valid range of each parameter
checksum over the array whether corruption is detected at start-up

The fourth row explains a common failure after a reconstruction: a device with a blank EEPROM that runs its check, finds a mismatch, and refuses to operate. The program is right and the data is missing.

A refusal that is not a failure

If the external interface does not respond, that is not evidence that the EEPROM is empty. The interface may be disabled by the product’s own wiring, the die’s interface logic may be damaged while the array is intact, or the supply may be outside the range the part requires.

The way to distinguish is to attempt the read with the device removed from the board, in a socket, with a known supply. That single step converts an ambiguous result into a definite one.

Delivering both regions with their status

The program image with the word convention, the configuration decoded, and the sixteen bytes presented as raw data with their addresses and, where the code establishes it, their roles.

Specific to this part, the delivery should state how the EEPROM was obtained — external interface, through the processor, or from the die — because a customer assessing the reliability of a reconstruction needs to know whether the values came from the device or from a pattern.

Where the sibling part with half the program memory has the same array and a different failure profile, PIC12CE518 binary recovery covers reconstruction. Where the same sixteen bytes are discussed from the design side, PIC12CE674 software follows the verification. And where an eight-pin OTP part has no such array at all, PIC12C509A binary covers that case.

The short version

Sixteen bytes on a two-wire bus, outside the protection model by design. Try the external read first on a failed unit, do not assume a non-response means empty, and tell the customer that anything stored there was never a secret.