PIC18F25K80: CAN Is a Second Door Into the Same Room
When a device is chosen for its CAN controller, the product usually speaks CAN for more than control. Field updates over the vehicle or machine bus are common, and where they exist there is a bootloader in the device listening for them. That loader is a documented, functional, write-capable interface — and it is present whether or not the array is protected.
Starting from that interface rather than from the programmer changes the shape of the work. It answers different questions, and on many projects it answers the only questions that mattered.
What the CAN path provides
A bootloader reached over CAN typically implements:
- an entry condition, triggered by a specific frame or a pin state at reset;
- an identification exchange, so the host knows which device and which version answered;
- an erase command;
- a data transfer with addressing;
- a verification step, and a jump to the application.
Each of those is a fact about the design. The identification exchange especially: a loader that reports a version and a part identifier is telling you what the vendor considered sufficient to distinguish builds.
| Loader feature | What it reveals |
|---|---|
| Entry trigger | How production and service enter the loader |
| Identification | Part, version, sometimes a variant code |
| Erase granularity | How the vendor thinks about the memory map |
| Address scheme in transfers | Where the application is expected to live |
| Verification | Whether the loader checksums, and over what range |
The message objects are in RAM
The CAN controller holds its filter and message objects in RAM, configured by firmware at start-up. That matters for two reasons.
First, the configuration is a fingerprint. The set of identifiers a device accepts, the masks it applies, and the number of objects it uses describe the protocol it implements, and all of it is observable on the bus without any access to memory.
Second, because the objects are in RAM, they are not part of the flash image. A recovered image does not contain the device’s CAN configuration — it contains the code that writes it. Reproducing the configuration means running the code, not copying a table.
Reading the bus instead of the array
For a device on a working machine, the bus is a richer source than the array in one specific respect: it is live. Behaviour under real load is available, and the firmware’s decisions are visible as messages.
A capture gives:
- the identifier set, and therefore the message structure;
- the cycle times, and therefore the scheduler’s period;
- the payload layouts, and therefore the signals, scaling and units;
- the fault handling, when something is disconnected.
The fourth item is the one people forget to provoke. Disconnecting a sensor and capturing what the device does reveals its fault policy, which is usually a distinctive part of the firmware and not derivable from normal operation.
What the loader gives up
A CAN bootloader designed for field updates cannot be protected against being used. If it were, updates would not work. So on a device with a loader, there is always an interface that will accept a program.
That has a consequence worth stating: a locked K80 device with a working CAN loader is not a lost device. It is a device that can be restored to a known image at any time — and if the goal is a working unit, the loader is the whole solution.
The distinction between restoring and reading remains the same as everywhere else in this family. The loader writes. It does not read. A device restored through CAN is a device running a known program, not a device recovered.
When both are needed
Some projects need both: the unit restored, and the original’s behaviour understood. In that case the order is:
- Capture CAN traffic from the working device, including fault conditions.
- Exercise the loader and record its protocol.
- Restore a replacement unit with a known image and confirm it behaves like the original.
- If the original’s program is still required, treat that as a separate problem with separate techniques.
Step three is often the end of the project. Organisations frequently commission a “firmware recovery” when what they need is a supply of working units and a documented protocol — both of which are obtainable without reading a protected array.
Practical notes
- CAN bit timing depends on the device clock; a capture at the wrong rate produces error frames rather than data.
- Loader entry conditions vary; some require a specific frame within a short window after reset, others a pin held low.
- The loader may preserve the data array during updates, which means calibration survives a reflash — useful when restoring, and a source of surprise when it does not.
- A device that answers on CAN is running code; a failure to read its array says nothing about whether it is alive.
Related reading
- PIC18F26K80 and the protection settings on the same silicon — the gates that the loader operates behind.
- PIC18F26K80 and boot block mechanics — where the loader lives in the array.
- PIC18F45K80 and the 44-pin variant — the same family in a different package.
FAQ
Can the CAN loader read the existing program? No. It writes and verifies; it has no read command.
Does code protection stop the loader working? No. The loader writes, and protection gates reads.
Are CAN settings part of the flash image? The code that configures them is; the registers themselves are RAM and are rebuilt at start-up.
Why capture during faults? Because fault handling is firmware behaviour that normal operation does not exercise.
Is restoring through CAN the same as recovery? It produces a working unit running a known image. It does not recover what was there.
Conclusion
On a part built for CAN, the bus is a second door: a write channel with a protocol that must remain functional, and a live view of the firmware’s decisions. For most projects that door is enough, and the harder question — what was in the array — turns out not to be the one that needed answering.