Table of Contents

lamaPLC: TWAI basics

TWAI basics The TWAI (Two-Wire Automotive Interface) was developed/applied by Espressif for the ESP32 microcontroller family, effectively implementing CAN Classic.

TWAI is a highly reliable, multi-master, real-time, serial asynchronous communication protocol designed for automotive and industrial applications.

The TWAI controller is not compatible with ISO11898-1 FD Format frames and will interpret them as errors. TWAI is effectively “CAN Classic,” not CAN-FD, which is what the automotive industry & promoters such as STMicroelectronics, Infineon, NXP, Texas Instruments, Kvaser, Bosch, Daimler, and GM wouldn't appreciate Espressif referring to their transceiver as “CAN,” which could confuse.

The TWAI standard supports both 11-bit and 29-bit identifiers. The protocol supports message prioritization with lossless arbitration, automatic retransmission, and fault confinement mechanisms. The ESP32 microcontroller includes TWAI controllers, allowing for the creation of one driver instance, as follows:

PlatformTWAI busses
ESP82660
ESP321
ESP32-S21
ESP32-S31
ESP32-C2(ESP8684)0
ESP32-C3(ESP8685)1
ESP32-C52
ESP32-C62
ESP32-C612
ESP32-H21
ESP32-P43

TWAI port specifically

Transmitting Messages

TWAI messages come in different types, each defined by its header. A typical data frame mainly includes a header and a data payload, with a structure similar to the following:

TWAI Transmitting Messages

TWAI topics on lamaPLC


This page has been accessed for: Today: 3, Until now: 10