The same MCP2515 driver works on one CAN module and repeatedly reports errors on another. Check the crystal top mark and module BOM first to establish whether its reference is 8 MHz or 16 MHz. Reading MCP2515 registers correctly over SPI shows that commands travel between the two chips. CAN bit length depends on the controller's oscillator frequency and bit timing registers.
Run the calculation with the raw register values
For the MCP2515, time quantum TQ = 2 × (raw BRP + 1) ÷ oscillator frequency. Suppose the raw BRP is zero and a bit spans 16 time quanta. At 16 MHz, a quantum is 125 ns, a bit is 2 µs and the rate is 500 kbit/s. Using the same configuration with 8 MHz gives 4 µs per bit and 250 kbit/s. The library call may still say “500K” if its oscillator argument selects the wrong source frequency.
Keep the crystal frequency with the CNF1, CNF2 and CNF3 readback values. Calculate the full bit length, then check where the sample point falls after the synchronization, propagation and phase segments. Two configurations that both use 2 µs per bit can sample at different times. Enter configuration mode and confirm the mode switch before writing the registers, read them back, then return to normal mode.
On a separate bench, connect a CAN analyzer with a known bit rate, correct termination and a peer able to acknowledge frames. Record transmission status, analyzer decoding and error counters. A lone transmitter can report errors due to missing acknowledgments, which can resemble a bit timing fault. Put the module crystal frequency and driver configuration in the same production change record so the required calculation is clear after future substitutions.Microchip MCP2515 datasheet, CAN bit timing and configuration registers
