Download Print this page

Espressif ESP32 Technical Reference Manual page 553

Hide thumbs Also See for ESP32:

Advertisement

21 Two-wire Automotive Interface (TWAI)
its TEC by 8 and a Receiver will increase its REC by 8. Each additional eight consecutive Dominant bits
will also increase the TEC (for Transmitters) or REC (for Receivers) by 8 as well.
7. When a Transmitter successfully transmits a message (getting ACK and no errors until the EOF is complete),
the TEC is decremented by 1, unless the TEC is already at 0.
8. When a Receiver successfully receives a message (no errors before ACK Slot, and successful sending of
ACK), the REC is decremented.
• If the REC was between 1 and 127, the REC is decremented by 1.
• If the REC was greater than 127, the REC is set to 127.
• If the REC was 0, the REC remains 0.
9. A node becomes Error Passive when its TEC and/or REC is greater than or equal to 128. The error condition
that causes a node to become Error Passive will cause the node to send an Active Error Flag. Note that
once the REC has reached to 128, any further increases to its value are irrelevant until the REC returns to
a value less than 128.
10. A node becomes Bus Off when its TEC is greater than or equal to 256.
11. An Error Passive node becomes Error Active when both the TEC and REC are less than or equal to 127.
12. A Bus Off node can become Error Active (with both its TEC and REC reset to 0) after it monitors 128
occurrences of 11 consecutive Recessive bits on the bus.
21.3.4 TWAI Bit Timing
21.3.4.1 Nominal Bit
The TWAI protocol allows a TWAI bus to operate at a particular bit rate. However, all nodes within a TWAI bus
must operate at the same bit rate.
• The Nominal Bit Rate is defined as number of bits transmitted per second from an ideal Transmitter and
without any synchronization.
• The Nominal Bit Time is defined as 1/Nominal Bit Rate.
A single Nominal Bit Time is divided into multiple segments, and each segment is made up of multiple Time
Quanta. A Time Quantum is a fixed unit of time, and is implemented as some form of prescaled clock signal in
each node. Figure
21-5
illustrates the segments within a single Nominal Bit Time.
TWAI Controllers will operate in time steps of one Time Quanta where the state of the TWAI bus is analyzed at
every Time Quanta. If two consecutive Time Quantas have different bus states (i.e., Recessive to Dominant or
vice versa), this will be considered an edge. When the bus is analyzed at the intersection of PBS1 and PBS2,
this is considered the Sample Point and the sampled bus value is considered the value of that bit.
Segment
Description
SS
The SS (Synchronization Segment) is 1 Time Quantum long. If all nodes are perfectly
synchronized, the edge of a bit will lie in the SS.
PBS1
PBS1 (Phase Buffer Segment 1) can be 1 to 16 Time Quanta long. PBS1 is meant
to compensate for the physical delay times within the network. PBS1 can also be
lengthened for synchronization purposes.
Espressif Systems
Table 21-5. Segments of a Nominal Bit Time
553
Submit Documentation Feedback
ESP32 TRM (Version 5.2)

Advertisement

loading
Need help?

Need help?

Do you have a question about the ESP32 and is the answer not in the manual?