1

Can someone explain to me what is CAN BUS protocol stack? Is it CAN BUS+ higher layers, like CANopen with 7 layers or something else, and can someone explain how can I use CAN stack, how I connect it with CAN bus, and why I need it?

Thank you

Lundin
  • 195,001
  • 40
  • 254
  • 396
aztaztazt
  • 15
  • 3

1 Answers1

1

Yes it is CAN hardware with higher layer protocols, such as CANopen, J1939 or DeviceNet.

In terms of the "OSI model", it only really makes sense to speak of layers 1-3 and 7, where CAN is layers 1 and 2 and a protocol like CANopen roughly provides layers 3 and 7. Roughly, since CAN-open also comes with hardware specifications such as baudrate, sync point & stub length recommendations.

What's known as a "protocol stack" is really just a library with a platform-independent API, usually delivered with hardware-specific drivers. If the vendor claims that they support a particular MCU, then it usually means that you get the drivers from the vendor.

So basically you buy this pre-made library and integrate your program with it, then get standardized protocol behavior on the CAN bus, necessary to communicate with other nodes implementing the same protocol. Writing such a library yourself is no small task, particularly not for CANopen which is a big standard, where you are probably just going to use some 10% of the available functionality.

Lundin
  • 195,001
  • 40
  • 254
  • 396
  • Thank you. I was reading this article also (https://www.embitel.com/blog/embedded-blog/what-is-can-protocol-stack-why-its-critical-software-solution-for-ecu-communication) and there is a CAN stack with two layers, CAN IF and CAN NM. I guess those are some layer from "OSI model", like CAN NM is Network layer, or I am wrong? There is also Transport level (ISO 15765) and I've also found in some articles that for CANopen there are 7 layers, not only just 3 or 7, so I am little bit confused. – aztaztazt Feb 28 '20 at 10:57
  • @aztaztazt Yeah that's about some automotive protocol called ISO TP. Same principles. General info from a canonical source, CAN in Automation: https://www.can-cia.org/can-knowledge/. – Lundin Feb 28 '20 at 11:31