Practical CAN-Bus intro

Gotchas after 100M+ messages in my own cars

I sent 100M+ messages when I built my own electric cars and in just a few minutes you will understand the basics behind CAN-Bus networking and the most common pitfalls.

Understanding the CAN bus is a key requirement for every automotive firmware engineer or battery software engineer.

Ok: You have two wires, CAN-H and CAN-L that transmit a differential signal. You can add hundreds of devices, and each CAN message is split into a CAN ID and a Payload of 8 Byte. Your devices need to agree how fast they speak to each other - in practice this is typically a 500kbps Baud-Rate.

The CAN ID doubles as the message priority, 0x001 is the highest priority message in any network.

Need to see messages in a car? The OBD2 Port is your friend and exposes the CAN bus to you. Not the messages you wanted? Manufacturers sometimes have multiple buses per vehicle.

I suggest you watch the video above and save yourself some pain. This is part of the vehicle control knowledge base, there are separate sections for battery design, lithium battery charging and more. Have a browse.

CAN Bus hardware

  • Two twisted wires with 2V differential signal
  • Two resistors of 120 Ohm either end
  • The OBD2 port gives you access to the CAN bus
  • You need at least two devices
  • Swapped wires are a common mistake

Protocol and Software

  • CAN ID doubles as the priority, 0x001 highest in any network
  • 8 Bytes of payload
  • Many devices speak at 500 kbps Baud Rate
  • Beware of oversaturation, don't send too many messages