Site Information

 Loading... Please wait...

SAE J1939 ECU Programming & Vehicle Bus Simulation with Arduino - The MCP2515 Library

Posted by Wilfried Voss on

This post is part of a series about SAE J1939 ECU Programming & Vehicle Bus Simulation with Arduino.

SAE J1939 ECU Programming & Vehicle Bus Simulation with Arduino

Microchip Technology’s MCP2515 is a stand-alone Controller Area Network (CAN Bus) controller that implements the CAN 2.0B specification. It is capable of transmitting and receiving both standard (11-bit) and extended (29-bit) data and remote frames. The MCP2515 has two acceptance masks and six acceptance filters that are used to filter out unwanted messages, thereby reducing the host MCU’s overhead. The MCP2515 interfaces with microcontrollers (MCUs) via an industry standard Serial Peripheral Interface (SPI).

As with any serial networking controller, the essential function calls are:

  1. Initialization
  2. Read Data
  3. Write Data
  4. Check Status

In case of the MCP2515 library, these functions are represented by:

  1. Initialization: CAN0.begin
  2. Read Data: CAN0.readMsgBuf incl. CAN0.checkReceive, CAN0.getCanId
  3. Write Data: CAN0.sendMsgBuf
  4. Check Status: CAN0.checkError

A Comprehensible Guide to J1939

SAE J1939 has become the accepted industry standard and the vehicle network technology of choice for off-highway machines in applications such as construction, material handling, and forestry machines. J1939 is a higher-layer protocol based on Controller Area Network (CAN). It provides serial data communications between microprocessor systems (also called Electronic Control Units - ECU) in any kind of heavy duty vehicles. The messages exchanged between these units can be data such as vehicle road speed, torque control message from the transmission to the engine, oil temperature, and many more.

A Comprehensible Guide to J1939 is the first work on J1939 besides the SAE J1939 standards collection. It provides profound information on the J1939 message format and network management combined with a high level of readability.