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...

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 »


ESP32: CAN Bus Programming with MCP2515 and MCP2517FD

For good reasons, the ESP32 processor is a prevalent choice for embedded hardware development. Besides considerable memory resources, it provides various hardware features for many applications, most prominently the Internet of Things (IoT). All that comes with more than reasonable price tags, specifically when you use one of the multiple ESP32 development modules. And since [...]

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 »


ESP32 Application: Galvanically Isolated CAN Bus Repeater and Baud Rate Converter

With this application, I am adding yet another example to the vast CAN library we developed over the years. The use of the Dual Isolated CAN Bus HAT with the ESP32 opens the door to a number of possible applications. The development of a CAN repeater and/or Baud Rate Converter came to mind first, because the [...]

Read More »


ESP32 Serial Ports - UART0, UART1, UART2 Access Using the Arduino IDE

In the following, I am using the ESP32 WROOM Devkit for this tutorial in combination with the Arduino IDE. For more information on programming the ESP32 using the Arduino IDE, please refer to “Getting started with ESP32 development board and Arduino.” The Arduino IDE uses the Serial class (assigned to UART0) to access the USB port [...]

Read More »


Arduino IDE Boards Manager - Do NOT Install ESP32 by Espressif Systems Version 3.00-alpha1

Today, I experienced a little scare. As usual, I opened the Arduino IDE on my Windows-11 machine, and as a first action, I allowed the recommended updates. Not suspecting any significant problems, I added some code and compiled it, only to end up with multiple error messages.  I found nothing wrong with the code I had [...]

Read More »


Dual-Channel Linear Actuator Control Module with ESP32 Processor

As part of a customer project, I, with the help of a capable hardware designer, developed an embedded system to control two linear actuators, specifically the Thomson Electrac HD model with SAE J1939 interface.  The Electrac series of actuators supports two higher-layer protocols (HLP) based on Controller Area Network (CAN): CANopen, and SAE J1939. CANopen is [...]

Read More »


ESP32, ESP32-S2 - Serial Port, Native USB Access using Arduino IDE

The test setup, as shown in the image, represents the hardware of a new project that requires reading CAN (Controller Area Network) data frames, combining them with real-time information plus GPS position, and storing the result onto an SD card. This post will focus on the ESP32 communicating with the GPS module delivering NMEA 0183 [...]

Read More »


ESP32 with Dual Isolated CAN Port Controls Thomson Electrac Linear Actuator

The above image shows part of a hardware setup for a customer project to control and synchronize two Thomson Electrac linear actuators. See also my posts:Thomson Electrak Linear Actuator with SAE J1939 Interface for Railway and Industrial Applications Thomson... Electrak HD Linear Actuator - Multiple Actuators in the Same Network Will Empty the Batteries... Thomson Electrac HD [...]

Read More »