Monday, September 24, 2012

Saab I-BUS info...

So it took me a day or so to figure out that the Saab I-Bus talks on a non-standard speed: 47.619Kbps. Most other CANBUS interfaces talk at 50, 100, 125, 250, 500, or 1000Kbps (1MBit). It's easy to change the speed, but there are many factors that affect the speed in the CANBUS chip/module.

Inside the CAN folder, there is a file called CAN.cpp. You need to edit the CAN.cpp file with Notepad or similar.

Scroll to where it says “switch(speed)”, and you should see several chunks of code that reference “case 1” and “case 500” and a few more. Anytime after the “{“ and before the next “}”, between the other cases, add the following code and save the file:

case 47:
#if (DEBUGMODE==1)

You can see how each case designates a case (I called mine 47 because the Saab I-Bus communicates at 47.619kbps), and by default, this software is not setup to allow us to communicate at the same speed as our Saab I-Bus. So all we're doing here is changing the speed parameters and assigning that speed to “47”. You'll notice that in the Arduino code, I called “CAN.begin(47)”. This is where the Arduino tells the Secuduino to talk to the I-Bus at 47.619kbps.

The "CNF1", "CNF2", and "CNF3" values (registers) we set tell the MCP2515 to talk at 47.619Kbps. These values are different for each speed setting. You can look at the datasheet for this chip and try to decipher it all; it's hard for me to grasp most of it :P

The site has a calculator to help you choose the proper register values for what speed and clock values you give it.

Probably more information than you needed/wanted to know, but I think it's good to share none the less.

No comments:

Post a Comment