EasyManua.ls Logo

Espressif ESP32-S2 - Page 457

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. 21: Bit timing configuration for 500kbit/s given BRP = 8
The sample point of a bit is located on the intersection of Timing Segment 1 and 2. Enabling Triple Sampling will
cause 3 time quanta to be sampled per bit instead of 1 (extra samples are located at the tail end of Timing Segment
1).
The Synchronization Jump Width is used to determine the maximum number of time quanta a single bit time can
be lengthened/shortened for synchronization purposes. sjw can range from 1 to 4.
Note: Multiple combinations of brp, tseg_1, tseg_2, and sjw can achieve the same bit rate. Users should
tune these values to the physical characteristics of their bus by taking into account factors such as propagation delay,
node information processing time, and phase errors.
Bit timing macro initializers are also available for commonly used bit rates. The following macro initializers are
provided by the TWAI driver.
TWAI_TIMING_CONFIG_1MBITS()
TWAI_TIMING_CONFIG_800KBITS()
TWAI_TIMING_CONFIG_500KBITS()
TWAI_TIMING_CONFIG_250KBITS()
TWAI_TIMING_CONFIG_125KBITS()
TWAI_TIMING_CONFIG_100KBITS()
TWAI_TIMING_CONFIG_50KBITS()
TWAI_TIMING_CONFIG_25KBITS()
TWAI_TIMING_CONFIG_20KBITS()
TWAI_TIMING_CONFIG_16KBITS()
TWAI_TIMING_CONFIG_12_5KBITS()
TWAI_TIMING_CONFIG_10KBITS()
TWAI_TIMING_CONFIG_5KBITS()
TWAI_TIMING_CONFIG_1KBITS()
Acceptance Filter The TWAI controller contains a hardware acceptance filter which can be used to filter messages
of a particular ID. A node that filters out a message will not receive the message, but will still acknowledge it.
Acceptance filters can make a node more efficient by filtering out messages sent over the bus that are irrelevant to the
node. The acceptance filter is configured using two 32-bit values within twai_filter_config_t known as the
acceptance code and the acceptance mask.
The acceptance code specifies the bit sequence which a messages ID, RTR, and data bytes must match in order
for the message to be received by the TWAI controller. The acceptance mask is a bit sequence specifying which
bits of the acceptance code can be ignored. This allows for a messages of different IDs to be accepted by a single
acceptance code.
The acceptance filter can be used under Single or Dual Filter Mode. Single Filter Mode will use the acceptance
code and mask to define a single filter. This allows for the first two data bytes of a standard frame to be filtered, or
the entirety of an extended frames 29-bit ID. The following diagram illustrates how the 32-bit acceptance code and
mask will be interpreted under Single Filter Mode (Note: The yellow and blue fields represent standard and extended
frame formats respectively).
Dual Filter Mode will use the acceptance code and mask to define two separate filters allowing for increased flexi-
bility of IDs to accept, but does not allow for all 29-bits of an extended ID to be filtered. The following diagram
Espressif Systems 446
Submit Document Feedback
Release v4.4

Table of Contents