Seeed shield CAN version 1.2 - AS 7 - Suitable Library

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi.  I can get the above shield working with a Arduino Uno by importing the Arduino IDE project into AS 7.

However, I am interested in ridding/removing the AS Solution/Project with all the imported Arduino IDE programs.  The CAN library is the same as  that for Arduino IDE.

 

Can anyone suggest a more suitable library (or how to hack the current library) ???

 

Regards JC....

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It should be pretty easy to use the Arduino library code  (note: The Arduino IDE is irrelevant) for the CAN module. For the most part it is C. The C++ stuff is usually pretty easy to unwind.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I do a lot of CAN stuff in Arduino. Assuming the shield uses the MCP2515 CAN controller, the two libraries I usually recommend are:

 

https://github.com/pierremolinar... written and documented to academic standards and the author is very helpful

https://github.com/coryjfowler/M... one of the most popular libraries; author is active on the Arduino forums

 

The code is nothing complex; mostly reading/writing device registers over SPI, so it should be straightforward to copy/paste into your own project, whether C or C++.

 

You can poll for incoming CAN frames or, preferably, use an interrupt. The first library implements an ISR-driven message buffer cache.

 

There can be fun and games if you have more than one SPI device and are using the interrupt approach. Arduino provides SPI 'transactions'.

 

(There is a persistent rumour that the MCP2515 is actually an ECAN-equipped PIC running a hardwired program).

Last Edited: Sat. Aug 1, 2020 - 01:18 PM