Reverse Engineering Microcontroller PIC16CR83 Heximal: A Mask ROM Reads Differently
The letter R in the part number is the whole story. A PIC16CR83 is the same die design as its flash sibling with one substitution: the program array is a mask-programmed read-only memory rather than an electrically writable one. Every question that follows — how it is read, what protection means, whether the result can be used to build another unit — takes a different answer because of that single change.
Most recovery experience is with flash, and flash intuition transfers badly here. This note is about where it fails.
Three arrays, three physical mechanisms
| Property | flash | OTP | mask ROM |
|---|---|---|---|
| how a bit is stored | charge on a floating gate | charge on a floating gate, one write | presence or absence of a programmed feature in the diffusion or via layer |
| written by | electrical erase and write | electrical write, once | the photomask at wafer fabrication |
| content changes with age | slowly, by charge loss | very slowly | not at all |
| protection acts on | the read path through the interface | the sense path | the interface, and in practice on nothing inside the die |
| readable after opening | yes, with effort | yes | yes, often more directly |
| can be reproduced in a blank part | yes | no | no |
Three of those rows matter more than the rest.
The third: a mask ROM does not lose its content. There is no charge to leak, so a device from 1998 reads exactly the same today. Ageing arguments that apply to flash — read margin, retention, refresh — do not apply, and a report that raises retention as a risk on a ROM part is describing the wrong technology.
The fifth: because the content is a physical pattern rather than a stored charge, opening the device exposes it. Optical inspection of a ROM array can, with the right preparation, render the programmed bits as a visible pattern. On small arrays this is often more conclusive than any electrical method.
The sixth: there is nothing to write. A blank flash part can be programmed with a recovered image; a ROM part cannot, because it was never writable. Reproduction means either a different silicon or a new mask set.
What protection means when there is no writable array
On a flash part, protection is a configuration bit that survives because the array is writable and the bit is part of it. On a ROM part, the configuration is fixed in the mask, so protection is not something that can be set after the fact — it is a property of how the mask was drawn.
In practice this reduces to the interface: the device can be built so that the programming interface does not disclose the array. But the array itself has no inhibit mechanism comparable to a flash part’s, because there is no sense amplifier chain that has to be gated in the same way.
The practical consequence is that a ROM part described as protected is usually easier, not harder, than a protected flash part, because the information is accessible by inspection rather than by defeating an active inhibit.
Reading the array from the die
The work has three stages.
Removal of the package, then removal of the layers above the array. The array is in the diffusion and contact layers, so the metal and the passivation have to come off in a controlled way — controlled because the pattern that carries the data is only a few hundred nanometres below the surface and an aggressive etch removes it.
Imaging. Under an optical microscope the programmed and unprogrammed cells differ in appearance, because the mask determines whether a contact or an active region is present. The contrast is not always strong enough for automated reading, and on fine geometries the image needs to be assembled from overlapping fields.
Transcription. The image is a bitmap of cells; the data is a sequence of fourteen-bit words in address order. The mapping from cell position to address is determined by the array’s row and column decoders, which are visible on the die and follow the family’s layout. Getting this mapping wrong produces a file of the right length with the words in the wrong order — which, as with any convention error, verifies and does not run.
Why the file is small and the analysis is not
The program array on this part is eight hundred and some words. A complete image is under two kilobytes of file, and the interesting content fits in a few printed pages. That makes the transcription error-checkable in a way that a large image is not: the reset vector should decode to a jump, the interrupt vector should decode to something plausible, and the ratio of code to blank should match a design of the era.
The analysis, though, has a complication that flash does not: there is no reference image. On a flash part, an engineer can compare against a sibling unit, re-read, or try a different convention and see which one runs. On a ROM part the die is consumed, and the only check is internal consistency.
That makes the transcription stage the one to slow down on: two independent readers, or two imaging passes at different magnifications, are worth the time.
The cost structure, stated plainly
A ROM job costs differently from a flash job, and the difference is not in the electronics.
The extraction is preparation-heavy: opening the package, removing the layers above the array without disturbing it, and imaging at sufficient magnification to resolve individual cells. Most of that time is setup, and the setup does not scale with the size of the array — a thousand words and eight thousand words take similar time to expose and similar time to image.
The transcription is where the size matters, because it is done cell by cell and checked by structure. On this part it is a few hours. On a larger array it becomes the dominant cost.
The analysis is the same as for any part of this core, and it is where the value is, because a ROM image with no annotation tells a customer nothing they cannot see in the product’s behaviour.
Quoting a ROM extraction as though it were a flash read is the common commercial error in this area. The electronics are not harder; the preparation and the absence of any reference to check against are.
Reproduction, stated honestly
A customer asking for a ROM part’s content usually has one of two intentions, and they need different answers.
The first is to keep existing equipment running. That is a replacement problem, and the answer is a pin-compatible flash part programmed with the recovered image — which works if the design does not depend on ROM-specific behaviour, and it usually does not, because the same design was sold in both versions.
The second is to build more of the original product. That is a mask problem: a new mask set, a wafer run, and a minimum quantity that makes the exercise pointless for anything short of a production programme. The recovered image is a necessary input to that, and it is not sufficient.
Telling a customer which of the two applies, before they commission the work, is more valuable than the file itself.
Where the two-array flash version of the same design is discussed, PIC16F83 eeprom recovery covers the writable case. Where the protection mechanism of an OTP part is the contrast being drawn, PIC16C771 firmware sets out read inhibition. And where a baseline-core part has to be reconstructed from its state machine rather than its array, PIC16C554 software takes that route.
The short version
No floating gate, no charge loss, no rewrite. A ROM array is a pattern in the silicon, it can be imaged, and it does not decay. Protection is a property of the mask rather than a bit, the transcription is the risky step because there is no reference to check against, and reproduction means new silicon — flash if the goal is repair, a new mask if the goal is production.