EasyManua.ls Logo

Espressif ESP32-S2 - Page 351

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
Configure Driver
There are several parameters that define how particular channel operates. Most of these parameters are configured
by setting specific members of rmt_config_t structure. Some of the parameters are common to both transmit
or receive mode, and some are mode specific. They are all discussed below.
Common Parameters
The channel to be configured, select one from the rmt_channel_t enumerator.
The RMT operation mode - whether this channel is used to transmit or receive data, selected by setting a
rmt_mode members to one of the values from rmt_mode_t.
What is the pin number to transmit or receive RMT signals, selected by setting gpio_num.
How many memory blocks will be used by the channel, set with mem_block_num.
Extra miscellaneous parameters for the channel can be set in the flags.
When RMT_CHANNEL_FLAGS_AWARE_DFS is set, RMT channel will take REF_TICK or
XTAL as source clock. The benefit is, RMT channel can continue work even when APB clock is chang-
ing. See power_management for more information.
When RMT_CHANNEL_FLAGS_INVERT_SIG is set, the driver will invert the RMT signal sending
to or receiving from the channel. It just works like an external inverter connected to the GPIO of certain
RMT channel.
A clock divider, that will determine the range of pulse length generated by the RMT transmitter or discrim-
inated by the receiver. Selected by setting clk_div to a value within [1 .. 255] range. The RMT source clock
is typically APB CLK, 80Mhz by default. But when RMT_CHANNEL_FLAGS_AWARE_DFS is set in
flags, RMT source clock is changed to REF_TICK or XTAL.
Note: The period of a square wave after the clock divider is called a tick. The length of the pulses generated
by the RMT transmitter or discriminated by the receiver is configured in number of ticks.
There are also couple of specific parameters that should be set up depending if selected channel is configured in
Transmit Mode or Receive Mode:
Transmit Mode When configuring channel in transmit mode, set tx_config and the following members of
rmt_tx_config_t:
Transmit the currently configured data items in a loop - loop_en
Enable the RMT carrier signal - carrier_en
Frequency of the carrier in Hz - carrier_freq_hz
Duty cycle of the carrier signal in percent (%) - carrier_duty_percent
Level of the RMT output, when the carrier is applied - carrier_level
Enable the RMT output if idle - idle_output_en
Set the signal level on the RMT output if idle - idle_level
Specify maximum number of transmissions in a loop - loop_count
Receive Mode In receive mode, set rx_config and the following members of rmt_rx_config_t:
Enable a filter on the input of the RMT receiver - filter_en
A threshold of the filter, set in the number of ticks - filter_ticks_thresh. Pulses shorter than this setting will
be filtered out. Note, that the range of entered tick values is [0..255].
A pulse length threshold that will turn the RMT receiver idle, set in number of ticks - idle_threshold. The
receiver will ignore pulses longer than this setting.
Enable the RMT carrier demodulation - carrier_rm
Frequency of the carrier in Hz - carrier_freq_hz
Duty cycle of the carrier signal in percent (%) - carrier_duty_percent
Level of the RMT input, where the carrier is modulated to - carrier_level
Espressif Systems 340
Submit Document Feedback
Release v4.4

Table of Contents