CAN Basics (bit-wise arbitration, differential signals)
The CAN Basics Training Course provides a practical approach to understanding how CAN works. By giving real world examples, common practices, and an in-depth look at DBC files, Bryan Hennessy gives a real-world walkthrough of CAN.
Presentation by Bryan Hennessy. Recorded as part of a ‘live’ training session in January 2019.
Bryan Hennessy: [00:00:01] Different types of frames. There are a few different types of frames, not going to get into a whole lot of that because it’s a more advanced subject. But in essence, there’s three different types of frames. Ninety-nine plus percent of what you’re going to see in an actual bus is going to be a data frame. There’s a remote frame, which is basically a request for a data frame that I’ll show you in one example that I have. Then there’s error frames.
It’s enough to say on the error frames because I’m not going to get into it, that’s a bit more advanced subject, but CAN has a very elaborate and detailed error control method, if you will, of evolving state machines and how many errors have been on the frame and can actually even isolate and turn the device off that has been printing too many errors on the network.
There was a bit that I mentioned at the end of the [00:01:00] CAN frame that’s generally a recessive bit. I have to go back to it. I don’t remember the exact acronym for that but I’ll show it to you in a bit. But, if any device on the network doesn’t receive the data properly and it would know this by the CRC being incorrect for the data. CRC is calculated as the data comes in. The transmitting unit has calculated a cyclic redundancy check, it’s called a CRC, and all the receiving devices calculate the CRC. It better be right at the end when it’s compared to the CRC that’s actually transmitted, or the receiving device knows there was an error in that communications.
One of the beauties of CAN that makes it so reliable is, if every single device, every single CAN receiver calculates and checks that CRC [00:02:00] when a CAN frame comes in, and if any device on the network sees a mismatch, in other words has received an error, then it takes that single bit, that one bit, toward the end of the frame and it makes it the dominant bit. When that happens, every device on the network knows that somebody got an error and that frame is thrown out by every single device on the network. So in other words, if everybody on the network doesn’t receive the frame properly, everybody throws it away. Nobody considers that a valid data. That makes CAN very reliable from the data link layer anyway. It makes it very reliable.
That message has to be received by everybody in the network correctly or it’s not going to be valid data. So that’s basically what the CRC does. Then error frames go from there with a little more complicated.