A few tips on trying to get a CAN bus to work…

Baud Rate

Check the baud rate is good using an oscilloscope.  If the baud is 250k for instance, that's 1 second / 250000 = 4uS per bit. You should be able to see 4uS individual bits being sent (the SOF at the start of a frame for instance if the following address bit is high).


Really easy to forget this but CAN buses need termination, its not a nice to have, its an essential.  When a bit is transmitted low the bus is forced into a state, but when a high bit is transmitted the bus is simply released – the resistance is needed to pull the bus back to the idle state quickly.  This isn't RS422/RS485 when high's and lows are forced onto the bus so you can sometimes get away without termination, the CAN bus is an arbitration based bus that uses idle as a specific bit state.  That means 120ohm resistors need to be placed at each end of the bus (although when developing you can often get away with 1 resistor if cable runs are short).  Here's an example of a 250k CAN bus device on its own (not connected to anything else).  First without the termination resistance (yellow and blue are the CAN-H and CAN-L bus connections):


The 4uS SOF bit has horrible slow trailing edges which the CAN bus peripheral in the device see's as the bit being longer than it is actually sending, causing it to dump TX assuming there is another device on the bus that it needs to concede arbitration to!

Now with a 120 resistor fitted across CAN-H and CAN-L:


A hard edged SOF bit leaving the device to carry on transmitting the rest of the packet.


We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.


Your email address will not be published.