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

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

Postby TheEnd » Wed Aug 12, 2015 1:05 am

Fulcrum wrote:

Just ran into the same issue myself. Very simple fix once you see it.... Extract the .zip library from Github and drill through it till you see a folder called "CAN_BUS_Shield". Now copy that folder into your Arduino libraries folder and that's it. Your library path should look like this: "...Documents\Arduino\libraries\CAN_BUS_Shield". In this folder you need to see the "mcp_can" files, and you'll see a folder named "Examples". Now it should compile.

Hope this was clear, good luck!



That hasn't worked for me unfortunately, the library was imported with Arduino IDE's " include library>add .zip library "
The library shows up, the examples show up and compile fine.
One interesting point is the github .zip gets installed by arduino as "CAN_BUS_SHIELD" folder name, but since the .zip is called "CAN_BUS_Shield-master.zip", a manual extracting makes a folder called "CAN_BUS_Shield-master"
Both folders are now present in C:\Users\User\Documents\Arduino\libraries and reporting as 69,499bytes in size, and the error now shows as-

Code: Select all
Arduino: 1.6.5 (Windows 7), Board: "Arduino Uno"

sketch_aug11a.ino: In function 'void setup()':
sketch_aug11a:19: error: 'CAN' was not declared in this scope
sketch_aug11a.ino: In function 'void loop()':
sketch_aug11a:35: error: 'CAN' was not declared in this scope
Multiple libraries were found for "mcp_can.h"

 Used: C:\Users\User\Documents\Arduino\libraries\CAN_BUS_Shield-master

 Not used: C:\Users\User\Documents\Arduino\libraries\CAN_BUS_Shield

'CAN' was not declared in this scope

 



It can find mcp_can.h, infact it can find them both and mention it, so it doesn't seem to be a library install issue.
Looking at github, it's been 2 years since the last change, so maybe it's an Arduino 1.6.5 compiler issue.
TheEnd
 
Posts: 2
Joined: Sun Aug 09, 2015 2:18 pm

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

Postby Fulcrum » Wed Aug 12, 2015 2:47 am

Still seems as though your library is not correctly installed.... your sketch is looking at the wrong library folder. Follow these steps and see if you have any luck:

1. Close Arduino

2. Delete all CAN library folders that you have in the library right now

3. Open Arduino, go to Sketch > Include library and verify that the CAN library does NOT appear in the list. Do NOT use "Add ZIP library".

4. Close Arduino

5. Copy only the "CAN_BUS_Shield" folder back into the library

6. Open Arduino, go to Sketch > Include library and you should now see the CAN library at the bottom of the list

Try to compile your code again. It should work this time, if it does not it should at least not return the same errors. I had to follow the above process exactly in order to get it to work on my laptop, and I was getting exactly the same errors you are. The CAN library will not install correctly by using the "Add ZIP library" function due to the way it is packaged. I am still using Arduino 1.6.3 but I highly doubt your issues are caused by using v1.6.5. However, anything is possible...
Fulcrum
 
Posts: 4
Joined: Tue Aug 11, 2015 4:33 am

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

Postby gtaion » Thu Aug 13, 2015 1:18 am

I'm completely new to all of this and had a couple questions about the latest version of the supersniffer application. There is a box for sending messages.
First does that work, it seems like there should be a routine in the arduino sketch to handle passing messages back to the CAN.
Second what format needs to be used to send messages via the program?

Also I wanted to take a look at the source code, I have visual studio 2010 and it is looking for a project file. What was your source code written with?
gtaion
 
Posts: 7
Joined: Fri Jul 31, 2015 5:09 am

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

Postby Fulcrum » Fri Aug 14, 2015 7:01 pm

I'm completely new to all of this and had a couple questions about the latest version of the supersniffer application. There is a box for sending messages.
First does that work, it seems like there should be a routine in the arduino sketch to handle passing messages back to the CAN.
Second what format needs to be used to send messages via the program?

Also I wanted to take a look at the source code, I have visual studio 2010 and it is looking for a project file. What was your source code written with?


I am wondering the same thing. I was not able to send messages using the program. Also I did not see any code in the Arduino side that would handle sending messages back. It would be nice if that portion of the program worked, maybe it just didn't get fully implemented or the Arduino code just never had that functionality added.
Fulcrum
 
Posts: 4
Joined: Tue Aug 11, 2015 4:33 am

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

Postby MartinViljoen » Fri Aug 14, 2015 8:10 pm

Fulcrum wrote:
I'm completely new to all of this and had a couple questions about the latest version of the supersniffer application. There is a box for sending messages.
First does that work, it seems like there should be a routine in the arduino sketch to handle passing messages back to the CAN.
Second what format needs to be used to send messages via the program?

Also I wanted to take a look at the source code, I have visual studio 2010 and it is looking for a project file. What was your source code written with?


I am wondering the same thing. I was not able to send messages using the program. Also I did not see any code in the Arduino side that would handle sending messages back. It would be nice if that portion of the program worked, maybe it just didn't get fully implemented or the Arduino code just never had that functionality added.



Yep Sorry it was never implemented, Ive been meaning to do it, because it could be a very usefull feature, Both the code of the super sniffer and Arduino sketch will need to be ammended for this to work
Image
User avatar
MartinViljoen
 
Posts: 111
Joined: Mon Oct 06, 2014 5:23 pm
Location: Centurion South Africa

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

Postby gtaion » Mon Aug 17, 2015 5:39 am

MartinViljoen wrote:

Yep Sorry it was never implemented, Ive been meaning to do it, because it could be a very usefull feature, Both the code of the super sniffer and Arduino sketch will need to be ammended for this to work
.

http://copperhilltech.com/controller-area-network-can-prototyping-with-arduino/

So I read this book, didn't really learn anymore then what I've learned from reading this forum. However if you goto the website the author is giving away the code for free. The two pieces that stuck out to me were first he has a sketch that receives and sends (chapter 4.2.3), second he wrote a sample code with visual studio 2012 (4.3).

The sketch seemed to make sense to me, but it appears that he has added a lot of checks into the send routine and his receive format has a lot of carriage returns. Might give you some ideas?

His sample software needs some work and he admits that,
. it has a buffer issue, when I open it with a diagnostic season on the obd2 port it only takes a couple seconds before it crashes. I know you had mentioned wanting to rewrite the supersniffer from scratch. This may give you a starting block?

Also I'm all over the internet trying to figure the best way to get at my jeeps can-bus and it seems that everybody has a little different format but they all seem to be using hex values, is there a reason that you've chose decimal values?
gtaion
 
Posts: 7
Joined: Fri Jul 31, 2015 5:09 am

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

Postby MartinViljoen » Tue Aug 18, 2015 12:48 pm

gtaion wrote:
MartinViljoen wrote:

Yep Sorry it was never implemented, Ive been meaning to do it, because it could be a very usefull feature, Both the code of the super sniffer and Arduino sketch will need to be ammended for this to work
.

http://copperhilltech.com/controller-area-network-can-prototyping-with-arduino/

So I read this book, didn't really learn anymore then what I've learned from reading this forum. However if you goto the website the author is giving away the code for free. The two pieces that stuck out to me were first he has a sketch that receives and sends (chapter 4.2.3), second he wrote a sample code with visual studio 2012 (4.3).

The sketch seemed to make sense to me, but it appears that he has added a lot of checks into the send routine and his receive format has a lot of carriage returns. Might give you some ideas?

His sample software needs some work and he admits that,
. it has a buffer issue, when I open it with a diagnostic season on the obd2 port it only takes a couple seconds before it crashes. I know you had mentioned wanting to rewrite the supersniffer from scratch. This may give you a starting block?

Also I'm all over the internet trying to figure the best way to get at my jeeps can-bus and it seems that everybody has a little different format but they all seem to be using hex values, is there a reason that you've chose decimal values?


Thanks for the link I will go through it, Nice find.
I chose decimals cus its easier to work with and to remember a CAN node's ID number, for me its easier to remember say 650 than 0x4B etc.
Image
User avatar
MartinViljoen
 
Posts: 111
Joined: Mon Oct 06, 2014 5:23 pm
Location: Centurion South Africa

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

Postby luisfrances » Sun Aug 30, 2015 6:02 pm

HELP MARTIN!Please.
Just bought my Seed Can-Bus shield v1.2 to connect to UNO R3.
Downloaded github CAN libraries and uploaded Techtinker CAN BUS TOOL sketch to arduino.
well... nothing happens... just opened Serial Monitor and got message:
"CAN BUS Shield init fail
Init CAN BUS Shield again
Enter setting mode fall"
Don't know what to do...
...
until now!!
Just picked up "receive_check" example sketch and... COPIED LOOP and..
Voilá!
"

#include <SPI.h>
#include "mcp_can.h"

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

const int SPI_CS_PIN = 9;

MCP_CAN CAN(SPI_CS_PIN); // Set CS pin

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

START_INIT:

if(CAN_OK == CAN.begin(CAN_500KBPS)) // 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()
{
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();
}
}

I don´t know if it´s completly ok, but at least it works, and READS CAN-BUS MSGS displayed on SerialMonitor !
luisfrances
 
Posts: 3
Joined: Wed Aug 12, 2015 2:13 pm

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

Postby gtaion » Tue Sep 01, 2015 9:26 pm

luisfrances wrote:HELP MARTIN!Please.
Just bought my Seed Can-Bus shield v1.2 to connect to UNO R3.
Downloaded github CAN libraries and uploaded Techtinker CAN BUS TOOL sketch to arduino.
well... nothing happens... just opened Serial Monitor and got message:
"CAN BUS Shield init fail
Init CAN BUS Shield again
Enter setting mode fall"
Don't know what to do...
...
until now!!
I don´t know if it´s completly ok, but at least it works, and READS CAN-BUS MSGS displayed on SerialMonitor !



Code: Select all
// 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


You've already figured it out. When Martin wrote his sketch he used a version 1.0 or newer which had the SPI assigned to pin 10. Version 1.1 and newer (Yours is 1.2) have the SPI pin on 9. So if you don't tell it in the sketch which pin is the SPI pin the INIT will fail.

Just add the above code to the beginning of Martins sketch and you will be good to go.
gtaion
 
Posts: 7
Joined: Fri Jul 31, 2015 5:09 am

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

Postby luisfrances » Wed Sep 02, 2015 12:52 pm

gtaion wrote:
luisfrances wrote:HELP MARTIN!Please.
Just bought my Seed Can-Bus shield v1.2 to connect to UNO R3.
Downloaded github CAN libraries and uploaded Techtinker CAN BUS TOOL sketch to arduino.
well... nothing happens... just opened Serial Monitor and got message:
"CAN BUS Shield init fail
Init CAN BUS Shield again
Enter setting mode fall"
Don't know what to do...
...
until now!!
I don´t know if it´s completly ok, but at least it works, and READS CAN-BUS MSGS displayed on SerialMonitor !



Code: Select all
// 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


You've already figured it out. When Martin wrote his sketch he used a version 1.0 or newer which had the SPI assigned to pin 10. Version 1.1 and newer (Yours is 1.2) have the SPI pin on 9. So if you don't tell it in the sketch which pin is the SPI pin the INIT will fail.

Just add the above code to the beginning of Martins sketch and you will be good to go.


Ok! will do that!
Now i have another question!
I´ve setup the CAN shield to 115200baud and CANBUS to 500kbps.. Don´t know if it´s CANTOOL config problem, but everything´s ok with SerialMonitor, always displaying CAN messages (nonstop)... but when using CANTOOl.. it only shows the first 5 msgs and then it stops.. i will post pic.. are the default settings ok? Thanks![img]F:\DUMP_TECHTINKER.jpg[/img]
luisfrances
 
Posts: 3
Joined: Wed Aug 12, 2015 2:13 pm

PreviousNext

Return to OBD2 & CAN-BUS Projects

Who is online

Users browsing this forum: No registered users and 1 guest

cron