Wednesday, January 12, 2022

Arduino Nano and MCP2515 bringup problem

    When using examples from internet like this popular for example: https://github.com/autowp/arduino-mcp2515 make sure you check your MCP2515 adapter board's hardware. Author of library assumes that MCP2515 are connected with 16MHz clock, and example script CAN_read initialize connection with 16 MHz crystal. In case when your board comes with different crystal remember to change code accordingly.

In my case it was needed

mcp2515.setBitrate(CAN_125KBPS, MCP_8MHZ);

 instead of just:

mcp2515.setBitrate(CAN_125KBPS);

My noname adapter coming from depths of Asia looks similar to this:

For connection to Arduino Nano you can follow this guide: