EasyManua.ls Logo

Espressif ESP32-S2 - Page 459

Espressif ESP32-S2
1695 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Chapter 2. API Reference
Fig. 24: State transition diagram of the TWAI driver (see table below)
Label Transition Action/Condition
A Uninstalled -> Stopped twai_driver_install()
B Stopped -> Uninstalled twai_driver_uninstall()
C Stopped -> Running twai_start()
D Running -> Stopped twai_stop()
E Running -> Bus-Off Transmit Error Counter >= 256
F Bus-Off -> Uninstalled twai_driver_uninstall()
G Bus-Off -> Recovering twai_initiate_recovery()
H Recovering -> Stopped 128 occurrences of 11 consecutive reces-
sive bits.
Driver States Uninstalled: In the uninstalled state, no memory is allocated for the driver and the TWAI controller
is powered OFF.
Stopped: In this state, the TWAI controller is powered ON and the TWAI driver has been installed. However the
TWAI controller will be unable to take part in any bus activities such as transmitting, receiving, or acknowledging
messages.
Running: In the running state, the TWAI controller is able to take part in bus activities. Therefore messages can
be transmitted/received/acknowledged. Furthermore the TWAI controller will be able to transmit error frames upon
detection of errors on the bus.
Bus-Off: The bus-off state is automatically entered when the TWAI controllers Transmit Error Counter becomes
greater than or equal to 256. The bus-off state indicates the occurrence of severe errors on the bus or in the TWAI
controller. Whilst in the bus-off state, the TWAI controller will be unable to take part in any bus activities. To exit
the bus-off state, the TWAI controller must undergo the bus recovery process.
Recovering: The recovering state is entered when the TWAI controller undergoes bus recovery. The TWAI con-
troller/TWAI driver will remain in the recovering state until the 128 occurrences of 11 consecutive recessive bits is
observed on the bus.
Message Fields and Flags The TWAI driver distinguishes different types of messages by using the various bit field
members of the twai_message_t structure. These bit field members determine whether a message is in standard
or extended format, a remote frame, and the type of transmission to use when transmitting such a message.
These bit field members can also be toggled using the the flags member of twai_message_t and the following
message flags:
Espressif Systems 448
Submit Document Feedback
Release v4.4

Table of Contents