The PIC18F4685 is the largest member of its CAN family: 96 KB of flash, 3,328 bytes of RAM, 1,024 bytes of data EEPROM, an ECAN module and a 10-bit ADC in a 40-pin package. It is also a part where a read-out that looks complete can be a third short, because the array does not end at the familiar 16-bit boundary. The flash runs from 0x0000 to 0x017FFF, and everything above 0xFFFF lives outside the range a casual dump tool treats as the whole world.
Six protect blocks, not four
Code protection on the 4685 follows the DS39761 layout. A boot block occupies the bottom of the array — 2 KB by default, selectable to 4 or 8 KB through the BBSIZ bits in CONFIG4L. Above it come six protectable blocks on fixed boundaries:
| Block | Range | Controlled by |
|---|---|---|
| Boot | 0x0000–0x07FF |
CPB |
| 0 | 0x0800–0x3FFF |
CP0 |
| 1 | 0x4000–0x7FFF |
CP1 |
| 2 | 0x8000–0xBFFF |
CP2 |
| 3 | 0xC000–0xFFFF |
CP3 |
| 4 | 0x10000–0x13FFF |
CP4 |
| 5 | 0x14000–0x17FFF |
CP5 |
Each bit lives in CONFIG5L at 0x300008, and each can be set independently. A dump from a part with CP4 and CP5 set returns 0x0000 for the top 32 KB and real firmware everywhere below — and 0x0000 is a legal instruction on this core, so the file still disassembles into a plausible ribbon of no-ops and code. Nothing in the file announces that it is truncated.
The completeness check
A complete image for a 4685 runs to 0x17FFF. Intel HEX carries the upper addresses in type-04 extended-address records, so a file that stops at 0xFFFF is missing exactly one third of the array — the region where XC8 places constant tables, and where this much flash usually means there are large lookup tables to place. On a CAN node the firmware is dense with message maps and calibration data, so the top of the array is rarely empty padding.
The second check is the device ID at 0x3FFFFE. The 4685 shares its family with the 4682 (80 KB) and the 4680 (64 KB), all in the same 40-pin package. A file “for a 4685” that ends at 0x0BFFF is actually a 4585 image, and burning it into a 4685 leaves the upper half blank. Reading the ID first settles which die is on the board before any flash image is judged complete.
What the EEPROM adds
The 1,024 bytes of data EEPROM at 0xF00000 sit under their own protect bit, CPD. On CAN nodes this is where the node address, filter defaults and per-unit calibration live. A clone with a correct flash image and a blank EEPROM will boot, pass bench tests and then misbehave on the bus, because it answers to the wrong address or interpolates sensor values with default constants. That failure gets reported as “the read did not work” when the read was complete and the EEPROM was never requested. The same pattern appears on its smaller sibling, the PIC18F4680, where the EEPROM holds the same class of data.
How the state is established
Because each block is separately locked, the useful output is a per-block statement: which of the seven ranges read as firmware and which read as zeros. From that map, the protection state of the part can be reconstructed without opening the package. Where blocks read as zeros and the ID confirms the die, the remaining routes are die-level, and the services page sets out what each route adds. For a 4685 the practical summary is short: read to 0x17FFF, read the EEPROM, and count a file that stops at 0xFFFF as two-thirds of an answer.
The boot block is also movable
The BBSIZ selection does more than resize the boot block — it moves where Block 0 begins, since Block 0 always starts at the boot block’s end. A unit programmed with an 8 KB boot block has Block 0 from 0x2000 to 0x3FFF, not 0x0800 to 0x3FFF. Interpreting a per-block read report against the wrong boot size mislabels the first protected boundary by up to 6 KB, on a part where the report is the primary evidence. The config words carry the answer, and they are readable even when every block is locked — which is why they are read before the array is interpreted, not after.
Service scope and next steps
Before we quote a PIC job we confirm the silicon revision and the protection configuration, because both decide whether the on-chip programming area can be read directly or needs a different approach. The full scope of what we handle, how a project runs from electrical integrity test to delivered file, and the payment terms are described on our service capabilities page.
Ready to extract this PIC firmware?
Send us the part number and a short description of what you need. Free evaluation, fixed quotation, and a reply within one business day.

Leave a Reply