Hi everybody,
I have a problem with Arduino Uno R3 and the Sparkfun Canbus-Shield
https://www.sparkfun.com/products/10039I am using the library
http://www.seeedstudio.com/wiki/images/0/0c/CAN_BUS_Shield_Code.zipSo far, I have successfully uploaded the following sketch, which does nothing but send the same message on the bus repeatedly:
#include "mcp_can.h"
#include <SPI.h>
void setup()
{
Serial.begin(115200);
if(CAN.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()
{
if(CAN.sendMsgBuf(0x00, 0, 8, stmp)==CAN_OK)
{
Serial.println("OK.");
Serial.println(CAN.sendMsgBuf(0x00, 0, 8, stmp));
}
else
{
Serial.println("ERROR.");
Serial.println(CAN.sendMsgBuf(0x00, 0, 8, stmp));
}
delay(1000);
}
Uploading works without problems, but the serial output looks like this:
Enter setting mode success
set rate success!!
Enter Normal Mode Success!!
can init ok!!
OK.
0
OK.
6
ERROR.
6
ERROR.
6
ERROR.
6
ERROR.
6
ERROR.
6
ERROR.
6
ERROR.
6
ERROR.
6
...
So after the message is sent two times, the buffer is full and no more messages can be sent - at least that is my guess.
Does anybody have experience with the CAN bus shield and can tell me what the problem is? I also tried other libraries, but this problem always remained the same.
Thank you so much,
papillon