Here, I present some information about the low-level operation of the
Universal Asynchronous Receiver/Transmitters (UARTs) on the ESP32-S3. I want to investigate how to use them without enabling
interrupts. I know that for some devices it is possible to enable an interrupt,
causing a flag to be set in the interrupt register, but leave the interrupt
table empty, such that no actual interrupt is generated. An important source of
information is Chapter 26: 'UART Controller' of the Technical Reference Manual. The ESP32-S3 has three UARTs each. The
transmit and receive buffers are taken from a shared 1024 byte region of RAM,
which is divided into 8 blocks of 128 bytes. The buffers start at fixed block.
This makes it possible to have larger transmit and receive buffers for some of
the UARTs, but limiting the buffers for others to zero, which basically
renders the UART (parly) unusable. The buffers of UART2 can be extended to
256 bytes without affecting the operations of UART0 and UART1 with at least
buffers of 128 bytes. (The use of the words 'Reserved' in Figure 26-3 are a
bit misleading, because the RAM regions can be used.) There is a possibility
to transfer large amounts of data by setting up a Direct Memory Access (DMA)
channel in the General Direct Memory Access (GDMA) device, which is described
in Chapter 3: 'GMDA Controller'. However the data goes through a Universal Host Controller Interface (UHCI), which, for example, is used
with USB. The UHCI performs some encoding and decoding to create a 'clean'
data stream surrounded with separators. It is not clear when an UART starts
sending data from the buffer. Is it as soon as a character is entered or only
when the buffer is filled with a certain number of characters and/or when a
certain character (such as a line-feed) is placed in the buffer. In the
reference manual it mentions that setting the UART_FORCE_XON bit
forces the transmitter to send data. This is only set in the
uart_ll_force_xon functions, which is called in
sleep_uart_resume function, which is called when the MCU returns from
sleep mode. This makes me wonder whether this is the only proper usage of it.
For the ESP32-S3 the function uart_ll_force_xon also the sets the
UART_SW_FLOW_CON_EN bit. In the reference manual it says: 'Set this
bit to enable software flow control.' That is maybe something you do not want
to be enabled, because it only works if the other side on the serial connection
also has it enabled with the same characters.
This months interesting links