May be I understand something wrong but I can’t find any information about the communication between Arduino and the CAN-shield. Can I stil use all pins from Arduino Uno (through stackable headers) or are some of them used to establish the communication between the microcontroller and the shield?
CAN-bus shield communicates with Arduino through SPI interface, so pin 13, 12, 11, 10 and 2 are occupied. Other pins on Arduino you can still use.
I have a good working CAN bus shield on the Arduino-Uno, but not anymore if the Arduino is serving a Adafruit VS1053 musicplayer on the SPI bus as well . According to my request to Adafruit, it could be pin10: Chip Select, that is double occupied now. (search adafruit forum with the word ‘happy’ for illustrations that I am not allowed to post here)
Can I re-pin number 10 of the CAN bus shield, and where in the libraries does this require modification?
You can see a pad beside the digital 9 and digital 10 on the CAN-BUS shield. Just cut off the connection between digital 10 and SS pin, and solder digital 9 and SS pin together, so you can use digital 9 as the SS pin.
thank you jacket, I will do this tomorrow:
and will try it out without (1) library-modification and (2) worrying about Arduino-Uno using pin 9 for RESET. (OK?)
p.s. for me it is not necessary to remove an existing solder connection
If you use the version of the library I’ve been debugging and improving, it will allow you to define the CS pin for the CAN shield.
Available here: github.com/coryjfowler/MCP2515_lib
If using digital 9 as CS pin, you need modify some codes:
#define SPICS 10
You need modify it in mcp_can_dfs.h , and you don’t worry about any other problems.
Thank you for the suggestions Jacket and Cory. I have now tried (unsuccessfully) the following and tested them separately in subsequent order :
(1) Make connection between Pin 9 and CS. As in picture:
(2) in library mcl_can_dfs.h I replaced #define SPICS 10 by #define SPICS 9
(3) I removed the connect between pin 10 (CAN shield) and pin 10 (Arduino), by bending pin 10, as in picture:
(4) Connect Adafruit MP3 player (CS) to pin 10 of Arduino-Uno, directly, not via connector from CANshield anymore (as in picture above).
I hope you like the pictures, because I that’s all I can do back for you right now. If you don’t have more suggestions, I guess I have to work my way through the library code.
My starting point would be my failing Arduino statement: if(CAN.begin(CAN_100KBPS) ==CAN_OK) and I think that because of the following:
The Arduino-Serial-Monitor says at start up :
- Enter setting mode fall
- Can init fail ! (and I believe that because my sketch is not responding on CAN strings as it should)
- Adafruit VS1053 Library Test
- SD OK!
- Nu GingGong afspelen (and the start-up tune actually plays through the loudspeaker)
and then the loop starts.
With my KvaserHS CAN bus monitor I see the CAN strings being sent, up with which the Arduino should respond by playing different MP3 songs, but it doesn’t (I give one manual command per several seconds).
Your suggestions make sense. I hope you have more potential solutions.
Hi , i have not used Adafruit MP3 player, so i may not show more useful suggestion to you, but one point you may have a attention.
Just cut off the copper wire between CS and digital 10 via a knife, so you don’t need do some other changes on CAN-BUS shield. Good luck.
sharp observation Jacket; I didn’t see that wire.
After cutting the small wire, the ohmic resistance between the two pads is infinite (out os scope of my little multi meter) (can that be?), but the software is not working any better.
I will have to start from the beginning again and see if there has gone anything wrong, since I now have all your suggestions.
Did you make the change in your source as well? I’ve been using multiple CAN_shields with other SPI enabled shields since I have modified the library to support changing the CS pin number.
I have tested it with the Ethernet shield, a second CAN_shield, and USB Host shield (SparkFun’s design).
[size=85]I am also having issues changing the CS pin for the CAN Shield. I am using a 2.8" TFT, this device uses pins 10 AND 9 on the Arduino Uno so I was looking use a different pin (7 or 6). Although I’m looking to use those different pins I was still unable to get the shield to work when using pin 9 (by soldering the CS pin to pin 9, disconnecting pin 10, and changing the SPICS 10 to SPICS 9 in the mpc_can_dfs.
Has anyone been able to change the CS pin yet? Is there something else in the libraries or source code that needs to be set to allow this to work?[/size]
Used the new library provided by Cory, it works! Missed that part the first time but thanks for your help.
Finally my Adafruit VS1053 works in combination with Seeedstudio CAN shield, however:
you need the new library of Cory (mid.2015: CAN shield now runs on pin 9 standard)
new library of Adafruit from 2015, runs on CS=10
pin 9 (adafruit shield RST) goes to pin 5 for example
reserve pin 2 for CAN shield interrupts.