The software configures SPI for the final 40 MHz system clock, but the first read after power-up often fails. Slowing SPI restores operation. In the specified configuration, the MCP2518FD can produce 40 MHz from a 4 MHz crystal through its ×10 PLL. The relevant clock for SPI is the system clock already established at the time of transfer. The intended frequency in the engineering record and the actual early startup frequency can differ by a factor of ten.
Check the reference, PLL, and system divider first. The manufacturer limits SCK to no more than half the system clock in addition to the absolute SPI maximum. If the system clock is 4 MHz during one stage, SCK is limited to 2 MHz in that stage. These are illustrative values for the stated configuration. Use an SCK rate valid for the current state when reading its status.
Make the startup stages observable. Read a known register at a conservative SCK rate, write the clock settings, and wait for and read the documented ready status. Then switch to the operating SPI divider and read known data again. Trigger on the first transaction and capture chip select and SCK. Mark when the readback changes. A trace of final working communication misses a premature speed change.
If a slower SCK still gives unreliable reads, check power, chip select, SPI mode, and oscillator connections instead of extending an arbitrary delay. Test fully cold startup, host-only reset, and controller-only reset separately because the retained clock states can differ. Save divider settings, status reads, and any failed transaction before and after increasing speed to determine whether the 4.000 MHz crystal actually needs replacement.Microchip MCP2518FD datasheet, oscillator and SPI timing
