How to select the best possible library for CAN?

Idahowalker:
I use the ESP32 CAN library

From the "ESP32" part of that, it doesn't sound like it will be useful to @OldFrank, who is using an Arduino Uno board:

OldFrank:
My hardware setup is connected as follows: Arduino Uno - CAN Shield (Robotdyn MCP2515 based) - CAN bus - Maxon EPOS4 motor controller - Maxon EC90 motor.


OldFrank:

  • The Arduino Library Manager installs ACAN2515 libraries (pierremolinaro) - also on Github

This one I presume:

OldFrank:

  • Github has got Arduino CAN for MCP2515 libraries (sandeepmistry)

That one is definitely of interest. Sandeep Mistry was one of Arduino's firmware developers for years. Sandeep does excellent work, but I haven't tried that library. If anyone else is interested, you can see it here:

OldFrank:

  • Seeedstudio has a CAN library for MCP2515

For the convenience of others, I'll provide the link:

There is another library you didn't mention that seems to be quite popular and is recommended by someone I know who is very knowledgeable about CAN bus:

Unfortunately, when I used this library, I found it has a serious bug, where it is initializing SPI from the constructor, a big no-no. The community submitted a fix here:

but the library author didn't merge it yet. So if you use that one I definitely recommend using the fork from that pull request:

or just making the SPI.begin() part of the pull request manually: