Sniffing the CAN-BUS with the SuperSniffer Software v1.xx

Re: Sniffing the CAN-BUS with the SuperSniffer Software v1.x

Postby sanfy126 » Mon Mar 21, 2016 7:48 am

So, I wanted to mess around a bit with the stock Radio on my 2007 Dodge Caliber, but in order to "Bench Power" the radio I needed to emulate the CAN BUS. I have a few different Arduinos, so I ordered the following shield:

http://www.elecfreaks.com/store/canbus- ... p-746.html

One of the first issues I've run into, I can't find the baudrate I need to communicate with ANYWHERE. People just say things like "Slow" and "Fast" but that means nothing to me if it doesn't translate to a number. I'd like to know if someone can kindly explain what rate I need. The default library for this device has settings for 5,10,20,40,50,80,100,125,200,250,500 kbps.

With that I've just been testing different values, but I'm getting nothing.

As for what I'm sending, here's a small sample:
CODE: SELECT ALL
unsigned char buffer[] = {0xFE, 0x16, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff};

CAN.sendMsgBuf(0x416 , 0, 8, buffer);


Am I headed in the right direction? Any hints as to what I'm doing wrong?
sanfy126
 
Posts: 1
Joined: Mon Mar 21, 2016 7:15 am

Re: Sniffing the CAN-BUS with the SuperSniffer Software v1.x

Postby yatishmhs » Mon Apr 11, 2016 9:55 am

Hello Trik, I am also planning to use sparkfun's can bus shield and arduino uno for connecting and getting can messages from my vehicle. As most of the people using seeedstudio's shield i am unsure which procedure to follow :roll:
till now, i have mounted shield on arduino and downloaded sparkfun's can bus library from git hub which include examples named as-
CAN demo, ECU demo, GPS demo, LCD demo and few more. I also downloaded puTTY to see CAN messages on my laptop and supersniffer tool from here.
I am not sure to select which port and speed while configuring putty and which library to use.
Please help me :|
yatishmhs
 
Posts: 1
Joined: Mon Apr 11, 2016 8:21 am
Location: india

Re: Sniffing the CAN-BUS with the SuperSniffer Software v1.x

Postby trik » Wed May 25, 2016 4:41 pm

yatishmhs wrote:Hello Trik, I am also planning to use sparkfun's can bus shield and arduino uno for connecting and getting can messages from my vehicle. As most of the people using seeedstudio's shield i am unsure which procedure to follow :roll:
till now, i have mounted shield on arduino and downloaded sparkfun's can bus library from git hub which include examples named as-
CAN demo, ECU demo, GPS demo, LCD demo and few more. I also downloaded puTTY to see CAN messages on my laptop and supersniffer tool from here.
I am not sure to select which port and speed while configuring putty and which library to use.
Please help me :|


Hallo Yatishmhs, the library You have downloaded is correct. To sniff the message from CAN network, I used the supersniffer tool, and have modified the original code to use with the sparkfun shield. The port to comunicate is the port that is identified by the arduino IDE,
than connect arduino with their shield to the PC, execute arduino IDE and see in the port list, wich identified.

this is the code modified to create the correct data string for supersniffer:
Code: Select all

    /*
    This is for use with Sparkfun's CAN Bus Shield: https://www.sparkfun.com/products/10039
    */
    #include <Canbus.h>
    #include <defaults.h>
    #include <global.h>
    #include <mcp2515.h>
    #include <mcp2515_defs.h>
    // 15765-4 protocollo clio iv 500kb
    void setup() {
      Serial.begin(38400); // For debug use
      Serial.println("CAN Read ");
      delay(1000);
     
      if(Canbus.init(CANSPEED_500))  //Initialise MCP2515 CAN controller at the specified speed
        Serial.println("CAN Init ok ....");
      else
        Serial.println("Can't init CAN");
        delay(1000);
    }
    void loop()
    {
    tCAN message;
    if (mcp2515_check_message())
    {

      if (mcp2515_get_message(&message))
       {
             //if(message.id == 0x015)  //uncomment when you want to filter
             //{
                   
                 
                   Serial.print("<"); Serial.print(message.id,HEX); Serial.print(",");
                   Serial.print(message.header.length,DEC); // ?
                   for(int i=0; i<message.header.length; i++)
                    {   
                      Serial.print(message.data[i],DEC); Serial.print(",");
                    }
                   Serial.print(">");
                   Serial.println();
                   
              //}  // close filter check
            }
     }

    } // loop



sorry for late, but is a lot of time tha i don't read this forum :)
User avatar
trik
 
Posts: 3
Joined: Fri Oct 23, 2015 2:34 pm
Location: Italy

Re: Sniffing the CAN-BUS with the SuperSniffer Software v1.x

Postby silversurfer » Wed Jun 22, 2016 6:06 pm

Hi guys. I have an Arduino Uno with Sparkfun can bus shield. I have also a DB9 to OBDII cable and a K+DCAN USB Interface.
I would like to know If I could test the shield without connecting to the car.
I read something about this in this thread but I didn't understand very well.

I connected the DB9 to OBDII cable to the shield then Arduino and K+DCAN interface to the laptop via USB cable.
Then I connected pins 6 and 14 of both ODBII connectors. Is there anything else to connect?

I opened connection to Arduino e K+DCAN interface serial ports using Putty but I cannot use the prompt to send data. It seems I cannot use the keyboard.
silversurfer
 
Posts: 1
Joined: Wed Jun 22, 2016 3:30 pm
Location: Italy

Re: Sniffing the CAN-BUS with the SuperSniffer Software v1.x

Postby MartinViljoen » Wed Jul 06, 2016 8:24 pm

silversurfer wrote:Hi guys. I have an Arduino Uno with Sparkfun can bus shield. I have also a DB9 to OBDII cable and a K+DCAN USB Interface.
I would like to know If I could test the shield without connecting to the car.
I read something about this in this thread but I didn't understand very well.

I connected the DB9 to OBDII cable to the shield then Arduino and K+DCAN interface to the laptop via USB cable.
Then I connected pins 6 and 14 of both ODBII connectors. Is there anything else to connect?

I opened connection to Arduino e K+DCAN interface serial ports using Putty but I cannot use the prompt to send data. It seems I cannot use the keyboard.


Hi SilverSurfer.

Yes you can i have done it in the past, however I'm unfamiliar with your K+DCAN USB Interface


The interface I used is an ELM327 USB interface,
look here See thread viewtopic.php?f=14&t=10, the white USB cable is not actually USB as such its just a connection from PIN 6 and 14 to the CAN HIGH and CAN LOW connection on the Arduino CAN-BUS shield.

I programmed to send repetitive messages in a loop, I then connected to the ELM 327 via putty and use an command to listen for the messages sent by the arduino.
After that I figured out how to send speed/RPM/coolant temp ect ect with the Arduino and then used the ELM327 interface to relay that to Diagnostic software and successfully managed to emulate Speed/RPM/Coolant temp and let it display on the Diagnostics software.

Back to the interface that you have, The only advice I can give is to make sure you are setting putty's baud rate to be the same as the K+DCAN USB Interface baud rate.
If you dont know what it is , try all of them, there arnt that many standard rates unless its using a non-standard rate.

If you have done that, you will have to google the K+DCAN USB Interface's documentation.
On the ELM327 when connecting the first time you have to enable a couple of settings such a line feed return otherwise all commands stay on one line and sometimes even 1 character and then you cant see what you are typing or what it's returning, It could also only activate once it reads a valid responsive.

You can also use the arduino the other way around to see what the K+DCAN USB Interface is sending.
Most software tools send a CAN message to the ODB2 bus in your vehicle to get a list of supported PIDs,So that it knows not to request stuff the ODB2 port doesnt have.
So maybe its waiting for that. 01 00 is a request to get a list of supported PIDs

So possibly if you let your arduino send 01 00 it might respond.

Otherwise buy the ELM327, its cheap as chips

Hope this helped.
Image
User avatar
MartinViljoen
 
Posts: 106
Joined: Mon Oct 06, 2014 5:23 pm
Location: Centurion South Africa

Re: Sniffing the CAN-BUS with the SuperSniffer Software v1.x

Postby mroberte » Fri Sep 16, 2016 2:47 am

Hi All, first off thank you for writing this program!

However, I have been trying to get this to work but not having much luck. I'm using the two wires from my radio (canH+ and -) and tried two canshields (seeedstudio v 1.2 and elecfreaks, they are the same thing it seems). Also checked the board to unsolder P1 however there is nothing there from the factory, just some solder that isn't touching. P3 is there tho. Red light is flashing so I know its receiving info, but just maybe the arduino isn't pushing the code to the program?

After getting everything setup, I'd try to get the arduino to push info to your program and would get a blank screen. I then checked the serial Monitor and it would give me back:

"CAN BUS Shield init fail
Init CAN BUS Shield again
Enter setting mode fall"

over and over when I set the baud rate to 115200. Both boards would give me the same results. What am I doing wrong? I'm trying this in a 2015 Audi A3 which should be similar to any VW product.
mroberte
 
Posts: 3
Joined: Fri Sep 09, 2016 4:01 am

Re: Sniffing the CAN-BUS with the SuperSniffer Software v1.x

Postby mroberte » Fri Sep 16, 2016 10:10 am

I think I have figured out the issue with using a Arduino Mega 2560 and the code. The SPI_CS_PIN changed from 10 to 9. I haven't went out to the car yet to try it, but the board is finally initializing when checking the serial monitor.

For anyone using this with a Mega and Seeedstudio Canbus shield, try this code:
Code: Select all
//This Arduino UNO Sketch requires the Seeed CAN-BUS Shield Libraries
//https://github.com/yexiaobo-seeedstudio/CAN_BUS_Shield
#include <SPI.h>
#include "mcp_can.h"

INT32U canId = 0x000;

unsigned char len = 0;
unsigned char buf[8];
char str[20];

// 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;
const int LED=8;
boolean ledON=1;
MCP_CAN CAN(SPI_CS_PIN);                                    // Set CS pin

void setup()
{
    Serial.begin(38400);

START_INIT:

    if(CAN_OK == CAN.begin(CAN_100KBPS))
    {
        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()
{
    if(CAN_MSGAVAIL == CAN.checkReceive()) 
    {
        CAN.readMsgBuf(&len, buf);
        canId = CAN.getCanId();
        Serial.print("<");Serial.print(canId);Serial.print(",");
        for(int i = 0; i<len; i++)
        {
            Serial.print(buf[i]);Serial.print(",");
        }
        Serial.print(">");
        Serial.println();
    }
}


Still get an error when I try the elecfreaks shield. Will report back if this finally works with the seeed version! #crossingfingers
mroberte
 
Posts: 3
Joined: Fri Sep 09, 2016 4:01 am

Re: Sniffing the CAN-BUS with the SuperSniffer Software v1.x

Postby mroberte » Tue Sep 20, 2016 10:10 pm

Well the code posted above allowed me to get it to work.

But I still had an issue, I could read the drivetrain CANBUS at 500Kbps, but could not get any information from the Audi Infotainment/Convenience canbus which runs at 100Kbps.

If anyone has any solutions please do fill me in (I'm a newbie to all of this).
mroberte
 
Posts: 3
Joined: Fri Sep 09, 2016 4:01 am

Re: Sniffing the CAN-BUS with the SuperSniffer Software v1.x

Postby Bimbo » Wed Oct 19, 2016 12:53 pm

Hi for All!

Sorry for my English.

Before i will say thanks Martin for your great work!

I try read my Volvo V50 using Arduino Mega 256 and Seedstudio CAN-Bus shield.
I connect CAN shield directly to Can Bus in dashboard and can see information in Can Bus.
But i don't understand Martin's sniffer tool. When i try open message (double click on message in main window) to see all messages with this ID, i see different ID's in this opened list. In my opinion in this list must be messages with only one ID. Same result with other ID's when i open ID with double click in main window.
Can anybody help me with this?

Thanks and have a nice day for all!

P.S. - I use Windows 7 64bit OS.
You do not have the required permissions to view the files attached to this post.
Bimbo
 
Posts: 4
Joined: Tue Sep 13, 2016 10:54 am

Re: Sniffing the CAN-BUS with the SuperSniffer Software v1.x

Postby MartinViljoen » Wed Oct 19, 2016 8:07 pm

Hi Bimbo.

I'm not sure what's happening, but its not supposed to happen the screen in your screenshot, should only contain messages from the same ID.
It looks like a bug.

Is it doing it all the time ?
Image
User avatar
MartinViljoen
 
Posts: 106
Joined: Mon Oct 06, 2014 5:23 pm
Location: Centurion South Africa

PreviousNext

Return to OBD2 & CAN-BUS Projects

Who is online

Users browsing this forum: No registered users and 3 guests

cron