MCP2515 CAN controller not receiving SPI

So instead of replying to an ancient topic, I decided to start a new one.

I'm attempting to get a SparkFun CAN bus shield (18-pin MCP2515 CAN chip) to work with an Arduino Uno R2. Since I've come back to this thing, I've found that a few people have written newer libraries than SKPang's; the two I've tried out are the CANDUINO library (Google Code Archive - Long-term storage for Google Code Project Hosting.) and Cory Fowler's library (GitHub - coryjfowler/MCP_CAN_lib: MCP_CAN Library).

With the CANDUINO, I tried the LoopBack .ino and found that it pretty much only blinks the LEDs on and off; I didn't see anything coming out of pins 3 and 5 of the DB9. So I gave up quickly and moved on to Cory's code. Unfortunately, his code didn't even blink the LEDs, let alone send data over CAN, so I started to dig in with the oscilloscope.

I already double-checked with a multi-meter that Arduino pin 10 is connected to the MCP's CS pin, and confirmed with a Serial.Println that the Loop is actually cycling.

When I load the following code from Cory's demo onto the Arduino...

// demo: CAN-BUS Shield, send data
#include <mcp_can.h>
#include <SPI.h>

MCP_CAN CAN0(10);                                      // Set CS to pin 10

void setup()
{
  Serial.begin(115200);
  // init can bus, baudrate: 500k
  if(CAN0.begin(CAN_500KBPS) == CAN_OK) Serial.print("can init ok!!\r\n");
  else Serial.print("Can init fail!!\r\n");
}

unsigned char stmp[8] = {0, 1, 2, 3, 4, 5, 6, 7};
void loop()
{
  // send data:  id = 0x00, standrad flame, data len = 8, stmp: data buf
  CAN0.sendMsgBuf(0x00, 0, 8, stmp);
  Serial.println("message sent?");  
  delay(100);                       // send data per 100ms
}

...my result is this:

  • TX0RTS (request-to-send for TX buffer 1) is stuck high at ~4.5V
  • TX1RTS is also
  • TX2RTS is also
  • SCK (SPI clock input) is low and going high at 10 Hz
  • SI (SPI data in) is stuck high at ~4.5V
  • SO (SPI data out) is also
  • TXCAN and RXCAN are oscillating at around 15.15 KHz
    RX high/low time is equal, TX spends much more time high
  • OSC1 (oscillator input) is oscillating at 16 MHz
  • OSC2 (output) is also

I don't see any specific pin definitions in the headers or preprocessor directives and they include the standard Arduino and SPI libraries, so I don't think there is a pin problem. What am I not checking that I should be? Does anything with my o-scope readings provide a clue?

Odd, are you using the latest Arduino IDE, version 1.0.5 I think, and do you have the CAN output connected to another operational CAN device? Even if the output was not connected, I would expect the CAN transceiver to transmit a message and try again until it errors out then shuts down the output because it never received an acknowledge message from another controller.