CAN-Bus sheild int fail on any Arduino except Seeeduino

Ardiuno Compatible shields

Moderator: cory.j.fowler

CAN-Bus sheild int fail on any Arduino except Seeeduino

by gjb » Mon Mar 10, 2014 8:44 pm

Hello,

Just got two CAN-Bus shields and one Seeeduino. I loaded the example "Send" file on the Seeeduino and loaded the "Receive-Check" example on a Leonardo. The Seeeduino can bus int is successful but the leonardo it fails. I reverse the CAN shield, same thing. I reverse the scetches, same thing. I try the files on a Arduno MEGA1280, same issue. I try it on a Arduino Pro Mini - same issue.

Has anyone been able to use the CAN bus lib on anything other than a Seeduino? Either file works just fine on that. I'm thinking the CAN bus shields are only compatible with the Seeeduino.
Pre-kindergarten
Pre-kindergarten
 
Posts: 4
Joined: Mon Mar 10, 2014 8:38 pm

Re: CAN-Bus sheild int fail on any Arduino except Seeeduino

by cory.j.fowler » Tue Mar 11, 2014 9:42 pm

gjb wrote:[...] loaded the [...] example on a Leonardo [...]

The Leonardo only has SPI available on the ICSP header.
I did your homework in high-school, remember?
Don't be afraid to PM me.
Kindergarten
Kindergarten
 
Posts: 80
Joined: Tue Sep 24, 2013 5:00 pm

Re: CAN-Bus sheild int fail on any Arduino except Seeeduino

by gjb » Tue Mar 11, 2014 10:01 pm

cory.j.fowler wrote:
gjb wrote:[...] loaded the [...] example on a Leonardo [...]

The Leonardo only has SPI available on the ICSP header.


OK, what does that have to do with it? I'm not connected using the ICSP header. What about the MEGA and the Pro?
I don't think that's the problem, but thanks.

Shields are supposed to be compatible with other Arduinos, this one seems that it is not.

And this isn't the only one. I have a motor shield from Seeed studio and I can't get it to work on other Arduinos. I haven't tried it on the seeeduino yet but willing to bet it works fine then.
Pre-kindergarten
Pre-kindergarten
 
Posts: 4
Joined: Mon Mar 10, 2014 8:38 pm

Re: CAN-Bus sheild int fail on any Arduino except Seeeduino

by cory.j.fowler » Tue Mar 11, 2014 10:45 pm

gjb wrote:OK, what does that have to do with it? I'm not connected using the ICSP header. What about the MEGA and the Pro?
I don't think that's the problem, but thanks.

Shields are supposed to be compatible with other Arduinos, this one seems that it is not.

And this isn't the only one. I have a motor shield from Seeed studio and I can't get it to work on other Arduinos. I haven't tried it on the seeeduino yet but willing to bet it works fine then.

The CAN Shield uses SPI on pins 11-13 to talk to the Arduino. The Uno and other ATmega328 based Arduinos have SPI on pins 11-13 as well as the ICSP header. The Leonardo does not have SPI on pins 11-13, therefore initialization fails since there is no SPI connection to the MCP2515.

The mega also uses the ICSP header for SPI.

Try it on an Uno, Diecimila, or Duemilanove before assuming it does not work on other Arduinos as those are the pseudo-standard that a majority of shields were designed around.

http://arduino.cc/en/Reference/Board?from=Guide.Board
I did your homework in high-school, remember?
Don't be afraid to PM me.
Kindergarten
Kindergarten
 
Posts: 80
Joined: Tue Sep 24, 2013 5:00 pm

Re: CAN-Bus sheild int fail on any Arduino except Seeeduino

by gjb » Tue Mar 11, 2014 11:37 pm

Any good reason it's not supported?

SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI communication, which, although provided by the underlying hardware, is not currently included in the Arduino language.


Don't have another uno to try it on.

Just another reason to port over to mbed, I've outgrown Arduino....
Pre-kindergarten
Pre-kindergarten
 
Posts: 4
Joined: Mon Mar 10, 2014 8:38 pm

Re: CAN-Bus sheild int fail on any Arduino except Seeeduino

by cory.j.fowler » Wed Mar 12, 2014 12:54 am

My apologies, that guide is apparently grossly outdated... SPI is definitely supported in the Arduino IDE at this time, however the Leonardo has SPI connected only to the ICSP header and any shield that does not derive SPI from the ICSP header (i.e., CAN BUS Shield) will not work stacked. You can use jumper wires and get it working.

This is more appropriate: http://arduino.cc/en/Reference/SPI
I did your homework in high-school, remember?
Don't be afraid to PM me.
Kindergarten
Kindergarten
 
Posts: 80
Joined: Tue Sep 24, 2013 5:00 pm

Re: CAN-Bus sheild int fail on any Arduino except Seeeduino

by gjb » Wed Mar 12, 2014 7:12 am

Thanks for the information.
I'll play with it some more.
Pre-kindergarten
Pre-kindergarten
 
Posts: 4
Joined: Mon Mar 10, 2014 8:38 pm

Re: CAN-Bus sheild int fail on any Arduino except Seeeduino

by yatsik77 » Sat Jun 14, 2014 4:04 pm

:?: Hi.
I use Arduino Mega2560 and CAN BUS shield.
Initialization failed. I don't know why?

About SPI in pins_arduino.h :
static const uint8_t SS = 53;
static const uint8_t MOSI = 51;
static const uint8_t MISO = 50;
static const uint8_t SCK = 52;
oll correct

Chip select pin in mcp_can_dfs.h
#define SPICS 10
same as Arduino UNO

What else??? :geek:
Pre-kindergarten
Pre-kindergarten
 
Posts: 2
Joined: Sat Jun 14, 2014 3:45 pm

Re: CAN-Bus sheild int fail on any Arduino except Seeeduino

by cory.j.fowler » Sun Jun 15, 2014 6:35 pm

I'm pretty sure the Mega uses the ICSP header for its SPI communication which is incompatible with the current version of the CAN shield since it uses the Digital IO (Uno pins 13 to 11) for its SPI. Try using jumper wires instead of stacking the shield, it should work.
I did your homework in high-school, remember?
Don't be afraid to PM me.
Kindergarten
Kindergarten
 
Posts: 80
Joined: Tue Sep 24, 2013 5:00 pm

Re: CAN-Bus sheild int fail on any Arduino except Seeeduino

by yatsik77 » Wed Jun 18, 2014 1:11 am

:mrgreen: WORK Arduino Mega 2560 + CAN BUS shield
1) in file "mcp_can_dfs.h" replace rows:
from
Code: Select all
#define MCP2515_SELECT()   digitalWrite(SPICS, LOW)
#define MCP2515_UNSELECT() digitalWrite(SPICS, HIGH)

to
Code: Select all
#define MCP2515_SELECT()   digitalWrite(SPICS, HIGH)
#define MCP2515_UNSELECT() digitalWrite(SPICS, LOW)


2) in file "mcp_can.cpp" function "INT8U MCP_CAN::begin(INT8U speedset)"
after row
Code: Select all
SPI.begin();
insert row
Code: Select all
SPI.setDataMode(SPI_MODE1);


In result we have:
"Enter setting mode success
set rate success!!
Enter Normal Mode Success!!
---------
CAN BUS Shield init ok!"
Pre-kindergarten
Pre-kindergarten
 
Posts: 2
Joined: Sat Jun 14, 2014 3:45 pm

Next

Who is online
Users browsing this forum: No registered users and 1 guest