CAN Bus Development With ESP32
CAN Bus Development With ESP32
This post will demonstrate how to add a CAN Bus port to the ESP32-WROOM32
development board, i.e., regarding hardware and software. As a matter of fact, we
already offer a hardware utilizing the ESP32 processor and an onboard CAN Bus
transceiver as shown in the image below:
The ESP32 WiFi, Bluetooth Classic, BLE, CAN Bus Module comes with an onboard ESP32
WROOM-32 WiFi, Bluetooth Classic, BLE Module, and a CAN Bus port with a transceiver.
Also, onboard is an RGB LED, IO pins on a 0.1" pad.
The programming is accomplished through the popular Arduino IDE connected to the
USB-to-Serial converter with USB-C connector, automatic bootloader and reset.
However, if you don’t need the supported 12 VDC power connection and extended
temperature range (specifically suited for automotive and industrial applications) but are
satisfied with the power supplied per USB port, you may prefer the lower-priced
application as described here.
The ESP32 integrates a CAN Bus controller compatible with the NXP SJA1000. Thus, it is
CAN 2.0B specification compliant.
As with the SJA1000, the ESP32 CAN Bus controller provides only the data link layer and
the physical layer signaling sublayer. Therefore, an external transceiver module is
required, which converts the CAN-RX and CAN-TX signals of the ESP32 into CAN_H and
CAN_L bus signals. The transceiver, such as the MCP2551 or SN65HVD23X, provides
compatibility with ISO 11898-2.
Note:
The SJA1000 does not support CAN-FD and is not CAN-FD tolerant.
CAN_TXD = ESP32 – IO25
CAN_RXD = ESP32 – IO26
For better resolution, download the PDF file.
In addition to the CAN port, we added an LED to indicate CAN Bus data traffic.
For the CAN Bus programming we used the resources as shown in the following. We didn’t
deem it necessary to repeat information in this post that is already sufficiently provided.
The CAN Bus driver source code plus code samples can be found at:
• sandeepmistry/arduino-CAN: An Arduino library for sending and receiving data
using CAN bus. (github.com)
For instructions on how to program the ESP32 using the Arduino IDE, see:
• How to Program ESP32 with Arduino IDE? (electronicshub.org)
Further Development Resources
• ESP32-DevKitC V4 Getting Started Guide...
• ESP32-WROOM-32D & ESP32-WROOM-32U Data Sheet (PDF)...
• Getting Started with ESP 32 | Introduction to ESP32...
• ESP32 vs ESP8266 - Which One To Choose?
• How to Program ESP32 with Arduino IDE?
• Interfacing I2C LCD with ESP32 | ESP32 I2C LCD Tutorial...
• A Beginner's Tutorial on ESP32 Bluetooth | Learn…
• A Complete Beginner’s Tutorial on How to Create…
• In-depth tutorial on ESP32 Servo Control | Web…
More Information...