Site Information

 Loading... Please wait...

Blog

ESP32 Processor with Internal SJA 1000 CAN Bus Controller

Posted by Wilfried Voss on

This post is an excerpt from our application note Controller Area Network (CAN) Development with ESP32.

ESP32 WiFi, Bluetooth Classic, BLE, CAN Bus ModuleThe ESP32 is a low-cost, low-power system-on-chip microcontroller with integrated WiFi and dual-mode Bluetooth. It employs a Tensilica Xtensa LX6 microprocessor in dual-core and single-core variations. It includes built-in antenna switches, RF balun, power amplifiers, low-noise receive amplifiers, filters, and power management modules. It is a successor to the ESP8266 SoC.

As practiced throughout this application note, I will not repeat details that are already available online but rather point to the ultimate source for information on the ESP32 processor: ESP32 WiFi & Bluetooth MCU I Espressif Systems.

ESP32 Features

  • Single or Dual-Core 32-bit LX6 Microprocessor with clock frequency up to 240 MHz.
  • 520 KB of SRAM, 448 KB of ROM, and 16 KB of RTC SRAM.
  • Supports 802.11 b/g/n WiFi connectivity with speeds up to 150 Mbps.
  • Support for both Classic Bluetooth v4.2 and BLE specifications.
  • 34 Programmable GPIOs.
  • Up to 18 channels of 12-bit SAR ADC and 2 channels of 8-bit DAC
  • Serial Connectivity includes 4 x SPI, 2 x I2C, 2 x I2S, 3 x UART.
  • Ethernet MAC is used for physical LAN communication (requires external PHY).
  • 1 Host controller for SD/SDIO/MMC and 1 Slave controller for SDIO/SPI.
  • Motor PWM and up to 16 channels of LED PWM.
  • Secure Boot and Flash Encryption.
  • Cryptographic Hardware Acceleration for AES, Hash (SHA-2), RSA, ECC, and RNG.

ESP32 Board Components

  • ESP-WROOM-32 Module
  • Two rows of IO Pins (with 15 pins on each side)
  • CP2012 USB – UART Bridge IC
  • Micro–USB Connector (for power and programming)
  • AMS1117 3.3V Regulator IC
  • Enable Button (for Reset)
  • Boot Button (for flashing)
  • Power LED (Red)
  • Some passive components

Further Development Resources


Internet of Things Projects with ESP32: Build exciting and powerful IoT projects using the all-new Espressif ESP32Internet of Things Projects with ESP32: Build exciting and powerful IoT projects

The ESP32, a low-cost MCU with integrated Wi-Fi and BLE capabilities, has various modules and development boards for efficiently building IoT applications. Wi-Fi and BLE are standard network stacks for Internet-of-Things applications, providing cost-effective solutions for your business and project requirements.

This book is a fundamental guide for developing ESP32 programs. It starts by explaining GPIO (General Purpose I/O) programming with sensor devices. The reader gets up to speed with ESP32 development through several IoT projects, such as weather stations, sensor loggers, smart homes, Wi-Fi cams, and Wi-Fi wardriving. The reader learns how to use ESP32 boards to facilitate interactions between mobile applications and cloud servers, such as AWS.  More Information...


Internal SJA 1000 CAN Controller

The ESP32 integrates a CAN Bus controller compatible with the NXP SJA1000. Thus, it is CAN 2.0B (ISO 11898, a.k.a. Classical CAN) 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 ESP32's CAN-RX and CAN-TX signals 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. To implement CAN-FD with the ESP32, you must utilize CAN-FD breakout boards accessible via the SPI port.

Adding a CAN Bus Transceiver

As with many other ESP32 hardware features, the CAN controller output (CAN_TX, CAN_RX) can be assigned to almost any GPIO. In the following, we assume GPIO25 (CAN_TX) and GPIO26 (CAN_RX), which appear to be a virtual standard in the industry.

The following image shows a schematic utilizing the popular SN65HVD CAN transceiver:

Alternatively, you can use our ESP32 WiFi, Bluetooth Classic, BLE, and CAN Bus Module to avoid hardware assembly via breadboard and external breakout boards.

ESP32 WiFi, Bluetooth Classic, BLE, CAN Bus Mod

This board has an onboard ESP32 WROOM-32 WiFi, Bluetooth Classic, BLE Module, and a CAN Bus port with a transceiver. Also onboard are an RGB LED and IO pins on a 0.1" pad. Programming is accomplished through the popular Arduino IDE connected to the USB-to-Serial converter with USB-C connector, automatic bootloader, and reset.

The ESP32 is a low-cost, low-power system-on-chip microcontrollers with integrated Wi-Fi and dual-mode Bluetooth. The ESP32 series employs a Tensilica Xtensa LX6 microprocessor in both dual-core and single-core variations and includes built-in antenna switches, RF balun, power amplifier, low-noise receive amplifier, filters, and power management modules. More Information...

Diesel Decoder – Turn Your Smartphone into a Heavy-Duty Diagnostics Tool

Turn your smartphone into a user-friendly HD diagnostic tool. Download and sync via Bluetooth to the free Diesel Decoder smartphone app to view vital diagnostic and trip data. When your rig throws a fault code, the Diesel Decoder is your reliable companion. It removes the guesswork, guiding you to either clear the codes and continue your journey [...]

Read More »


OBD-II and the Hacking of Automotive CAN Bus Networks

Let me clarify: this is not a guide to hacking automotive networks. Instead, I attempt to dismiss some common misconceptions about OBD-II and its supposed ability to control a vehicle (Spoiler alert: It cannot). As someone who has spent considerable time studying and working with CAN Bus technologies, I think it is time to set [...]

Read More »


Bluetooth OBD2 Scanner and Car Code Reader for iPhone & Android

EASY-TO-USE OBD2 APP & CAR CODE READER - The FIXD car scanner and OBD app instantly translates 7000+ engine fault codes into plain English on your phone. Wireless Bluetooth connection. Set up in minutes. No car knowledge needed. FIND OUT WHAT’S WRONG WITH YOUR CAR - Even beginners can use the FIXD OBD2 scanner and app [...]

Read More »


ESP32 Programming - Classical CAN to Bluetooth Gateway

In this post, I will present a CAN to Bluetooth gateway based on the ESP32 processor. The above image shows my test setup using our ESP32 WiFi, Bluetooth Classic, BLE, CAN Bus Module, a CAN-Bus Hub With 7 Ports And DC Power Connection, and the PCAN-USB Pro. As its description implies, the ESP32 module provides all necessary [...]

Read More »


Discover IoT Development with ESP32 to Create Production-Grade Smart Devices

The ESP32 is a low-cost, low-power SoC (System on Chip) microcontroller with integrated WiFi and dual-mode Bluetooth. It has shipped over 100 million units as of 2018 and powers many WiFi devices on the market. This book supplies end-to-end coverage of building an IoT system from the ground up to secure data communication techniques from [...]

Read More »


Under Development: Programmable CAN Bus to USB, Bluetooth, BLE, WiFi Gateway

For the longest time, I had resisted the idea of creating my version of a CAN-to-USB gateway, primarily due to the vast competition. A professional CAN/J1939 development requires a professional CAN-to-PC solution to monitor data traffic. I am pleased with the PEAK PCAN-USB device, as shown in the above image. However, not everybody is willing [...]

Read More »


Selection Criteria and Requirements for a Telematics Gateway

The  March 2023 issue of the CAN Newsletter, a CiA (CAN-in-Automation) online publication, posted an article on the selection criteria and requirements for a Telematics gateway. With cars evolving towards network technologies, OEMs (Original Equipment Manufacturers) require telematics solutions that boost seamless communication within and outside the vehicle. The device should be cloud-enabled, connectable to servers for real-time [...]

Read More »


SAE J1939 Protocol Stack Sketch for ESP32 Using the Arduino IDE

The ESP32 is a series of low-cost, low-power system-on-chip microcontrollers with integrated Wi-Fi and dual-mode Bluetooth. The ESP32 series employs a Tensilica Xtensa LX6 microprocessor in both dual-core and single-core variations and includes built-in antenna switches, RF balun, power amplifier, low-noise receive amplifier, filters, and power management modules. Furthermore, the processor provides the means to easily [...]

Read More »


NMEA 2000 / SAE J1939 Data Scanner with BLE Interface for iOS Applications

This post is a follow-up on NMEA 2000 Data Scanner with Bluetooth, BLE for Android, iOS, PC Applications. In this new post, I also include SAE J1939, since NMEA 2000 is based on J1939.  Also, in this particular case, instead of the NMEA2000-compatible 5-pin M12 connector, I used a DSUB9 as it applies to the CAN Bus [...]

Read More »