Hiya ... I'm doing an engine swap project on my car and will be using my Arduino Mega 2560 R3 to read from one CANBUS network (Nissan engine) and write on another (BMW instrument cluster).
I've got a PoC completed so I can drive the required items on the BMW instrument cluster but am unsure if I am able to use two Seeed CANBUS Shield v2's on a single Arduino ... and if so how to address them in my code separately ?
I'm new to Arduino / hardware programming so go easy
My current code can be found here if that's of use:
I see no reason you cannot however I am not sure what the interface looks like, a link to the part you are using would be a big help. I will take a SWAG and say they do not give you the ability to select them individually so you will have to make a mod that will allow different chip selects for each board.
Good Link! Your link states you can use two and also gives documentation on how to do it. You will have to make a trace cut and solder a jumper. They are addressed via the chip select wich (code dependent) you pass when you initialize the module. There are also interrupts involved and you either need to use two or determine how to separate the interrupter. This is again dependent on software and how the hardware is connected.
So at this point I'm wondering what will be the most straight forward way to go ... two CAN shields on a single Arduino or two Arduino's each with a CAN shield talking to each other some how ?
I would start with the 2x2 and get your feet wet so to say. That way you can take the examples from the library and get them working. When you reach this point you have two working CAN nodes. When you get here can build the dual shield module and be sure they are working, as you have known good nodes. At this point you will know your bridge is capable of doing what you want, the only thing left is to do the codes and be sure it is fast enough.
Added a TF card slot for data storage, and the CS pin can be either set to D4 or D5.
The INT pin can also be set to D2 or D3 by switching jumpers on the back of the shield.
We moved the P1 pad from front to the back of the shield to make it easier to cut and solder in case you want to use more than 2 CAN-BUS Shields, it is needed to cut the P1 pad.
I managed to get this sorted out and am happily running the two shields now
Code changes needed are here as well as cutting the link on the back of the shield and soldering the pad to dictate the use of pin 10 as SS/CS on one of the shields only.