Go Down

Topic: CAN bus (Read 8932 times) previous topic - next topic


Je m'intéresse à la mise en place d'un bus CAN pour connecter une dizaine d'Arduino.
Principal avantage, pas de maitre dédié ;-)

J'ai trouvé deux shields et pas mal d'infos ici :

Je ne sais pas si l'Arcan est compatible Mega 2560, j'attends le retour du créateur.
Avez-vous testé des produits ou une solution fonctionnelle de communication CAN ?


Jan 08, 2011, 01:19 am Last Edit: Jan 08, 2011, 01:37 am by igorreal Reason: 1
It´s a pity, but I don´t speak french...  (But I can understand what it´s written in your post, 90%  of the words are similar to spanish). :D

For sure, the SPI <--> CAN module from avrcard which I´ve been tinkering with in my blog works with any Arduino version. I´ve done some stuff with Mega version.

The problem using shields prepared to Arduino Diecimila, Duemilanove or UNO are not compatible with the Mega versions. (because the SPI pins are not in the same physical position).
If you want to use them, you need to do some "hack" (like in the past with the ethernet shield).

If you want, you can prepare yourself a board (http://www.avrcard.com/Documents/can/can_spi_schema_1_1.pdf )

As you can see, all of them are based of the same chip (MCP2515 CAN Controller).



Igor R.


Hi Igor,

Don't blame you, I can't speak spain myself. Let's communicate in english ;-)

In the future, I will perhaps prepare a board myself, by for the first checks, I prefer to buy them.
Do you think I can buy somes converters instead of shields, and use them with Arduino Can libraries ?
Could you advise me models of spi converters ?

Thanks !


Jan 09, 2011, 12:22 pm Last Edit: Jan 09, 2011, 12:44 pm by igorreal Reason: 1

You can use what you prefer, but I only advise you that these shields are not prepared for the Mega boards.

The MCP2515 Can controller uses SPI to communicate with the microcontroller. These pins are physically in:

  • Arduino UNO, Diecimila,Duemilanove => 13,12,11,10
  • Mega =>53,52,51,50

You can see a similar problem in the old ethernet shield:

At the end, all these hardwares are using the same CAN controller (MCP2515), and the code is going to be compatible, the only difference maybe is the clock used, but it´s a small change to do in the code for the SPI clock prescaler.

If you want a shield because it has an extra feature that you want to use, you always can do this "hack", but if you are only interested in the CAN feature, I prefer a SPI <->CAN board.

You can check for yourself the schematics.
You can find the links in my blog with shields, code, SPI <-->CAN  => http://real2electronics.blogspot.com/2010/06/can-bus-mcp2515.html

Regards,  ;)

Igor R.



Thanks for your explanations. I will do the trial with the avrcard board.  
Where could I download the library for Arduino ?



Check the links in my blog, there are a lot....



I don't know which library I can use with avrcard , because of this sentence :
but it´s a small change to do in the code for the SPI clock prescaler.

Any help should be welcome  ;)



You are looking for something "plug & play"..... ;)

All the code that I have in my blog is functional... Use the google translator at the beggining to try understand how it works. After you should able to understand all the libraries that you can find in internet.

For example you can use http://www.skpang.co.uk/catalog/product_info.php?cPath=140_142&products_id=706 (CAN-Bus ECU Reader demo sketch) , because they are also using a 16 Mhz for the MCP2515 as the avrcard hardware.



OK, let's go to translate then ;)
Thanks !

Go Up