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.
Video Transcript:
Bryan Hennessy: [00:00:01] I mentioned communication layers and a Protocol Stack, the intimidating terms that we’re going to clear up here, and that’s what I’m going to jump into right now. I’ll fall back to that a lot. Now make some notes on that. One of my main slides that I created is here with those layers that we’re going to explain and I’ll hopefully draw some notes out here to the right of those and show you how to interpret those and what goes on in those layers as we go. So this is, I think, a pretty good format for that. But you’ll see that slide right there quite a bit. In fact, it’s the next slide up.So, this slide I created a few months ago just to try and get this message apart. I modified it, it’s changing as time goes on as I learn how it’s accepted by the people that I’m working with on it. So, a basic CAN bus, the wiring on a basic CAN bus, we’ll get into a little bit more but the basic CAN bus has what we call the trunk and drop cables. [00:01:01] So, literally, a trunk cable is between two terminators. There’s a terminator on each end. Drop cables come off of that and go to the smart sensors or controls or displays or ECUs or whatever’s out there. That’s really the basics of a CAN bus. Every CAN bus in the world has two terminators of trunk cable and drop cables. That’s just how it is in every industry, in every application. That’s how they look. That’s what CAN is made to run on.That’s part of what I call the physical layer. The best way to understand the physical layer is the job of the physical layer is no more than getting 1’s and 0’s from one device to the other on that network, reliably sending 1’s and 0’s which is what all digital communications of course works on. That’s its whole job. It doesn’t have anything to do with the frame, it doesn’t have anything to do with a protocol, it doesn’t have anything to do with J1939 or CANopen; it’s just there [00:02:01] to get the 1’s and 0’s across.So when once you can get 1’s and 0’s reliably consistently across the network, your physical layer is good. That’s the best way to separate the physical layers. I understand that from all of the other more complicated stuff that works depending on how you look at it above that or below that in the Protocol Stack. So when you hear the term Protocol Stack, don’t be intimidated by that. They’re just referring to the different as they’re broken up so-called layers of the communication stack. Some people don’t really like the term layers, and I started to get away from using the term layers but that’s all you hear everywhere in the industry, is people talk about the data link layer. People talk about the applications layer. So I went back to it just because I want people to get more comfortable and more familiar with that term. Whether it’s right or not, whether you believe it’s a good concept or not, it’s used in the industry. It’s not going away. [00:03:01] We’re stuck with it. So we’re going to use the term layers quite a bit here.The next, from the physical layer once you get the 1’s and 0’s across the network, we have to understand how to break up and understand what those 1’s and 0’s represent, and that’s done via what we call the data link layer. The data link layer takes all the 1’s and 0’s if the physical layer can reliably send across the network and it packages them, if you will. It packages them in an understandable format called a CAN frame. And we’ll get very extensively into a CAN frame and take a frame apart so you understand the different parts of the CAN frame.The next one from that, which is sometimes used but not always, and I’ll explain why, is called the transport layer. A CAN frame is eight data bytes, only eight data bytes. A lot of data we want to send [00:04:01] is a lot more than eight data bytes. So a transport layer allows the packaging of messages that are more than eight data bytes. Allows the transmitter to package them in a number of different frames and allows a receiver, or receivers, to take them apart and understand what they are and reassemble the message, longer message, basically. The transport layer, as I’ll show the next slide, is different for different protocols, for different communication systems, whether it be NMEA 2000, or J1939, or CANopen, or others, they all have their own transport layer or transport protocol.So once you get past the data link layer, you’re no longer really talking about the CAN standard. You’re talking about a J1939 or you’re talking about a CANopen. They’re talking about some other standards. So CAN really is defined here. [00:05:01] This is where CAN is. You can send J1939 or you can send CANopen or NMEA 2000 over Ethernet. So it can be repackaged and sent over a different media, but this is where CAN is defined. This is where CAN is used as in these two layers. We’ll talk more about that, but these are standards or definitions that are communicated in different standards.So I took this slide and I wanted to add more complexity to it. It was starting to get full and complicated. So I kind of broke it out into the next slide. I used the same colors in the next slide and I just added a little bit of a text to it to prompt me to talk about the right things here. So, these are the same four layers. I show the transport layer [00:06:01] as not always being used by showing it off to the side with the dotted line. Many messages aren’t affected by the transport layer in their communication system. So they’re just passed directly from data link to applications if their messages were only eight data bytes, as I said.So, we got the physical layer on the left. It defines the wires, the baud rate, bit timing and basically again sends 1’s and 0’s, that’s a very important thing to remember about the physical layer, its main job, its only job.The data link layer, again, defines the frames, the structure, and it sends and receives CAN frames so that we can put a box around and understand what the data is. Transport layer, again, is with different high level protocols. It’s called different things. It may work in different ways. They’re not compatible. But like I say, Fast Packet is what NMEA 2000 developed and Fast Packet is [00:07:01] specific and good for what marine electronics needed at the time. The transport protocol is what it’s called in J1939. It’s different in that. It has quite a bit of limitations there. I won’t get into that because that’s a lot of detail. But an interesting point of a comment here is that when they hired on PACCAR Technical Center a number of years ago, they require a real thorough presentation, a half an hour presentation on some real technical subject and they all really critique you on that presentation. That’s part of getting a job there. They say that’s the hardest part. Well, my presentation was contrasting the transport protocol and the Fast Packet protocol. So I went and I still use some of the slides I developed for that presentation. I think there’s some of that material in here. So it’s neat stuff when you really look at it at the bit level.I’ve been recently studying CANopen, and there’s something called an SDO block transfer [00:08:01] that transfers messages more than eight data bytes in CANopen.Any questions so far? The layer concept, hopefully, is starting to make more sense now.Back to: CAN Basics Training: A Practical Introduction to the CAN bus > Basics