CAN basics guides
Start here if CAN is new to you. These guides explain how CAN works, how to connect to a bus safely, and how to send and receive frames from Python, C++ and embedded C.
10 guides Read them in this order
- What Is CAN Bus? A Simple Guide for Engineers Learn what CAN bus is, how CAN messages work, why vehicles use it, and what you need to start reading CAN data.
- How to Use CAN Bus: A Simple Step-by-Step Guide Learn how to connect to a CAN bus, set the bitrate, record frames, send a test frame, and decode data with a DBC file.
- CAN Frame Types Explained: Data, Remote, Error, and Overload Understand CAN data, remote, error, and overload frames. Learn to identify each in CAN logs, read RTR and FD flags, and check examples with candump and Python.
- CAN FD explained: why classical CAN had to evolve CAN FD extends classical CAN without abandoning the familiar ecosystem. Learn what changed in the frame, why payload and bitrate mattered, and when CAN FD is the better choice.
- CAN Bus Python Example: Send and Receive Messages Use python-can with SocketCAN to send, receive, filter, and test CAN messages in a small working Python example.
- CAN Bus C++ Example: Send and Receive with SocketCAN Build a small C++ SocketCAN program that opens can0, sends a CAN frame, waits for a frame, and prints the ID and data.
- How to Enable CAN Bus in Embedded C Code Learn the steps to initialize a CAN peripheral, configure bit timing and filters, start CAN, and send a frame from embedded C code.
- CAN bit timing and sample point: how to calculate them How to work out the CAN prescaler, time segments, SJW and sample point for any clock and bitrate. Worked examples for 8 to 80 MHz, a Python calculator, oscillator tolerance, SocketCAN settings and CAN FD.
- CAN bit stuffing, CRC and arbitration, bit by bit What a CAN frame looks like on the wire. Build one frame bit by bit in Python, calculate its CRC-15, insert the stuff bits, and watch three IDs arbitrate. Covers the CAN FD differences: CRC-17, CRC-21 and the stuff count.
- CAN acceptance filters and mailboxes: how to calculate the mask How CAN ID filters work, how to calculate a filter and mask for a set of IDs, how many unwanted IDs a mask lets through, and how mailboxes and receive FIFOs lose frames. With a Python calculator, SocketCAN and candump filters.