PIC18F66K22: Reading the Protection Pattern as a Design Statement
A protection configuration is a decision made by a person, usually at the end of a production process, usually with a reason. The combination of bits that results is therefore a record — not of intent in the abstract, but of what that person expected to happen to the product afterwards.
On a 64K part with four blocks, a boot region and two kinds of bit, the number of realistic patterns is small, and each corresponds to a recognisable product lifecycle.
The patterns
| Boot region | Application blocks | Reading |
|---|---|---|
| Open | Open | Development unit, or production oversight |
| Open | Closed | Vendor loader is public, application is the asset |
| Closed | Open | Loader is the secret, application is field-serviceable |
| Closed | Closed | Opaque product; service by replacement |
The second row describes products whose loader is documented — often because a distributor or a contract manufacturer needed to program blank devices, and publishing the loader was simpler than distributing it under agreement.
The third describes the opposite trade: the loader is the vendor’s differentiated asset and the application is ordinary. It is less common but appears in products where the loader contains a proprietary protocol or an authentication scheme.
What each pattern predicts
Open and open. No service constraint, so an update image is probably obtainable, and the production record probably still exists. This is the easiest case and the one people fail to check for.
Open loader, closed application. A field update path almost certainly exists. The loader will describe the image format and the application’s extent. Start there.
Closed loader, open application. The application can be read; the loading protocol cannot. The device is analysable and not updatable, which suggests service by replacement rather than by reflash.
Closed and closed. The device is opaque and the product was designed to be replaced. The remaining evidence is behavioural, plus whatever exists outside the device — schematics, sibling units, vendor documentation.
The bits that are not about protection
Two settings in the same configuration word are frequently mistaken for security and are not:
Low-voltage programming disable. It changes how the device is entered, not what may be read. Its presence in a locked device is common and its practical effect is to require a high-voltage entry.
Write protection. It freezes a region. A boot region that is write-protected and readable is a design that prevents field modification of the loader while allowing a technician to verify it.
Both appear alongside genuine protection bits and both change what is possible on a bench, which is why reading the configuration as a whole matters more than looking for one field.
Using the pattern before touching the device
The pattern is readable without attempting anything else, and it should be read first. Three consequences follow immediately:
- whether a read attempt is worth starting at all;
- which regions, if any, will respond;
- whether an update path is likely and therefore whether the behavioural route is the productive one.
That last is the practical payoff. A device whose configuration indicates a field-updatable product can be analysed almost entirely from its update traffic, without ever needing the array.
When the pattern contradicts the product
Occasionally the configuration says one thing and the product does another: an open loader with no update interface implemented on the board, or a closed device with a documented service procedure that requires reading it.
Both occur, and both are informative. The first indicates a design that was planned for updates and shipped without them — often because the interface was cut late. The second indicates that the vendor’s service procedure relied on something other than reading the device, usually a replacement part.
The limits of inference
A pattern is evidence, not proof. Configuration can be rewritten, including by a bootloader at runtime, so a device read after an update may carry settings the factory did not apply.
Reading the configuration twice — immediately after reset and after the application has run — resolves this, and the difference between the two readings is itself a statement about the design: a device whose configuration changes at runtime has a loader that manages it.
Related reading
- PIC18F65K22 and the limits of inference from an image — the same discipline applied to code rather than configuration.
- PIC18F26K22 and the 64K address space — where these blocks sit in the array.
- PIC18F45K22 and application-only updates — the arrangement the second pattern predicts.
FAQ
Can the pattern be read without unlocking anything? Yes. Configuration is readable through the programmer on this family.
Does a closed boot region mean the loader is valuable? Often. It is the one region whose protection implies a deliberate decision.
Is write protection part of the security design? It restricts modification, not reading. It is a separate decision that often accompanies protection.
Why read configuration twice? Because a bootloader can rewrite it, so the value after reset may differ from the value in operation.
What if the pattern contradicts the product’s behaviour? That contradiction is information: a planned feature that was not shipped, or a service procedure that did not rely on reading the device.
Conclusion
The protection pattern is a design statement written at the end of a production line. Reading it before doing anything else predicts the device’s lifecycle, indicates whether an update path exists, and decides whether the expensive techniques are needed at all. That is a lot of information from a handful of bytes.