Unable to read the can bus data

Unable to read the can bus data

Postby arun » Tue Sep 29, 2015 7:58 pm

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 Martin's can bus hack 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. Attached the image of the can bus shield here below.
[img]Can_bus_shield.png[/img]

I have connected this shield to Arduino UNO and used the default example that came with the library.
Code: Select all
/ 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
Code: Select all
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
You do not have the required permissions to view the files attached to this post.
arun
 
Posts: 2
Joined: Mon Aug 31, 2015 2:48 pm

Re: Unable to read the can bus data

Postby arun » Fri Oct 09, 2015 5:17 am

Patience paid of partially :)
I again cross checked the wires from the BCM and confirmed that the wires are taped at the right place. I suspected the compatibility of the hardware and the libraries that I was using in the program. So I tried using a different hardware this time from a local institute that handles can protocols. For the first time I saw can data flooding in both powertrain and convenience buses. WoW! one of those happy moments :), Thanks to Tangent technolabs guys who offered me their hardware for testing in my car. After confirming the compatibility issues I decided to change the hardware. Procured the new can bus shield from a local vendor and tried it.
This time I got the data from the powertrain can bus (500 KBPS) using the new hardware but not from the convenience wires. I am not going to play with powertrain can bus as it is little complicated for me at the moment. I have brute forced with different bit rate (Ideally it should be 100 KBPS) and nothing good.

Any suggestions please!!!
arun
 
Posts: 2
Joined: Mon Aug 31, 2015 2:48 pm


Return to OBD2 & CAN-BUS Projects

Who is online

Users browsing this forum: No registered users and 1 guest

cron