Hi, I am new to this forum. It is going to be a little long detailed description to explain the situation clearly, sorry about that. I was inspired by many can bus project and have been trying to do one in my car. I have a VW Vento 1.6TDI. The OBD port in the car provides access only to the powertrain can bus. I was more interested to read the data from the convenience can bus and play around with it. So I had taped wires from the BCM (Body Control Module) of VW that has all the Can bus going through it. I have got access to both the convenience and powertrain can bus from the BCM.
I have acquired the can bus shield and have connected this shield to Arduino UNO and used the default example that came with the library.
http://techtinker.co.za/forum/download/file.php?id=84
/ 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 <SPI.h>
#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 = 10;
MCP_CAN CAN(SPI_CS_PIN); // Set CS pin
void setup()
{
Serial.begin(115200);
START_INIT:
if(CAN_OK == CAN.begin(CAN_100KBPS)) // init can bus : baudrate = 500k
{
Serial.println("CAN BUS Shield init ok!");
}
else
{
Serial.println("CAN BUS Shield init fail");
Serial.println("Init CAN BUS Shield again");
delay(100);
goto START_INIT;
}
}
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 char canId = CAN.getCanId();
Serial.println("-----------------------------");
Serial.println("get data from ID: ");
Serial.println(canId);
for(int i = 0; i<len; i++) // print the data
{
Serial.print(buf[i]);
Serial.print("\t");
}
Serial.println();
}
}
I have changed the “const int SPI_CS_PIN = 10;” value to 10 as the default 9 did not work in my case.
I have also changed the can bus baud rate to 100KBPS as VW convenience can bus communicates in 100KBPS.
Even without connecting the can wires the initialization is happening correctly. I am able to get the message “CAN BUS Shield init ok!”.
But nothing else is happening beyond this point. There is no data transfer happening when the can wires are connected to the CAN-H, CAN-L of the shield. I have thoroughly checked the can wire connection and it is fine.
I also tried this with the powertrain can bus with a 500KBPS baud rate as mentioned in VW sites. Here as well there is no data displayed in the serial monitor.
Please help me.
Any help is much appreciated!!!
Thanks,
Arun