V2 Canbus shield for arduino

Dear Tech support,

Sorry to bother you guys but I have been using the V1.2 shields without issue and just swapped over to V2. Boards. Left default jumpers in place. Didn’t cut anything. So CS pin at 9 and not using D sub 9 connections or card slot.



I’ve got flashing red receive light on the board communication established indication but get no data. Same code as was running fine on V1.2. Tried with and without ground connection on can line.



Tried Putty as well as Arduino serial monitor. Code below. Kavaser sniffer is receiving data fine. Any Ideas?

[cid:[email protected]][cid:[email protected]]







// demo: CAN-BUS Shield, receive data with check mode

// send data coming to fast, such as less than 10ms, you can use this way

// loovee, 2014-6-13





#include

#include “mcp_can.h”





// the cs pin of the version after v1.1 is default to D9

// v0.9b and v1.0 is default D10

const int SPI_CS_PIN = 9;



MCP_CAN CAN(SPI_CS_PIN); // Set CS pin



void setup()

{

Serial.begin(9600);

pinMode(7, OUTPUT); //green LED comunication active





while(CAN_OK != CAN.begin(CAN_75KBPS)) // init can bus : baudrate = 75k (while not equal to 75kbs prints error)

{

Serial.println(“Vetus CAN BUS comm fail”);

Serial.println(“Init Vetus CAN BUS again”);

delay(100);

}

Serial.println(“Vetus CAN BUS comm established”);

}





void loop()

{

unsigned char len = 0;

unsigned char buf[8];





if(CAN_MSGAVAIL == CAN.checkReceive()) // check if data coming

{

CAN.readMsgBuf(&len, buf); // read data, len: data length, buf: data buf



unsigned long canId = CAN.getCanId();

//Serial.println("-----------------------------");

//Serial.print(“Get data from ID: 0x”);

Serial.print(canId, HEX);

Serial.print(" “);

Serial.print(len);

Serial.print(” ");

digitalWrite(7,HIGH);

delay(5);

digitalWrite(7,LOW);

Hi

Bob,

I just use the can bus shield v1 and v2, v2 is receiver and v1 is sending the data.

both of them work well. I use the send.ino for the v1 and receive_check.ino for the v2. you can see the tx/rx leds blinking.



Here is the output of the serial.

can bus shield v2 as receiver:
-------------------------
D: 0x0
0 0 0 0 0 0 2 4C
-----------------------------
Get data from ID: 0x0
0 0 0 0 0 0 2 4D
Enter setting mode success
set rate success!!
Enter Normal Mode Success!!
CAN BUS Shield init ok!
-----------------------------
Get data from ID: 0x0
0 0 0 0 0 0 2 5E
-----------------------------
Get data from ID: 0x0
0 0 0 0 0 0 2 5F
-----------------------------
Get data from ID: 0x0
0 0 0 0 0 0 2 60
-----------------------------
Get data from ID: 0x0
0 0 0 0 0 0 2 61
-----------------------------
Get data from ID: 0x0
0 0 0 0 0 0 2 62
-----------------------------
Get data from ID: 0x0
0 0 0 0 0 0 2 63
-----------------------------
Get data from ID: 0x0
0 0 0 0 0 0 3 0

can bus shield v1 as transimitter:

Enter setting mode success
set rate success!!
Enter Normal Mode Success!!
CAN BUS Shield init ok!

you putty output is not matched with below code. your putty more looks like the transmitter. your code is receiver.

Thanks

best rgds
Bill

Bill,

Thank you for taking a look at this. Not 100% sure what the issues was but I now have V2 boards running and pulling can data off my equipment at 75kbps as I did with the V1.2 boards. I suspect the source of the problem was some comm port conflicts. Seem to have gotten it sorted.