Chapter 2. API Reference
Signals Lines and Transceiver
The TWAI controller does not contain a integrated transceiver. Therefore, to connect the TWAI controller to a TWAI
bus, an external transceiver is required. The type of external transceiver used should depend on the application’
s physical layer specification (e.g. using SN65HVD23x transceivers for ISO 11898-2 compatibility).
The TWAI controller’s interface consists of 4 signal lines known as TX, RX, BUS-OFF, and CLKOUT. These
four signal lines can be routed through the GPIO Matrix to the ESP32-S2’s GPIO pads.
Fig. 20: Signal lines of the TWAI controller
TX and RX: The TX and RX signal lines are required to interface with an external transceiver. Both signal lines
represent/interpret a dominant bit as a low logic level (0V), and a recessive bit as a high logic level (3.3V).
BUS-OFF: The BUS-OFF signal line is optional and is set to a low logic level (0V) whenever the TWAI controller
reaches a bus-off state. The BUS-OFF signal line is set to a high logic level (3.3V) otherwise.
CLKOUT: The CLKOUT signal line is optional and outputs a prescaled version of the controller’s source clock
(APB Clock).
Note: An external transceiver must internally loopback the TX to RX such that a change in logic level to the TX
signal line can be observed on the RX line. Failing to do so will cause the TWAI controller to interpret differences
in logic levels between the two signal lines as a loss in arbitration or a bit error.
Driver Configuration
This section covers how to configure the TWAI driver.
Operating Modes The TWAI driver supports the following modes of operations:
Normal Mode: The normal operating mode allows the TWAI controller to take part in bus activities such as trans-
mitting and receiving messages/error frames. Acknowledgement from another node is required when transmitting a
message.
No Ack Mode: The No Acknowledgement mode is similar to normal mode, however acknowledgements are not
required for a message transmission to be considered successful. This mode is useful when self testing the TWAI
controller (loopback of transmissions).
Espressif Systems 444
Submit Document Feedback
Release v4.4