drivers: serial: nrfx_uarte: Rework driver to support new features
Rework driver to support new way of asynchronous RX handling. Previously RX was handled in two modes: using RXDRDY interrupt for byte counting or TIMER + PPI. Both modes had flaws. RXDRDY interrupt mode could miscalculated amount of received bytes when interrupt was not handled on time. Data was not lost but was not reported on time that could lead to issues. PPI+TIMER mode requires additional resources thus it was not the default mode. Often user was not aware of that option and was expiriencing driver RX faults. New RX mode is switching buffers when there is new data (RXDRDY event not set for given amount of time). It does not require additional resources to get precise byte counting. Additionally, this is in line with new UARTE feature (RX frame timeout) which is present in nRF54X devices. The behavior of the driver is the same for legacy devices and new one. For legacy devices k_timer periodic interrupts are used to check if there are any new bytes and it is not needed when RX frame timeout is present. Improved RX mode is enabled by default (CONFIG_UART_NRFX_UARTE_ENHANCED_RX=y) but legacy modes are still available though not recommended to be used. Note that new RX mode (CONFIG_UART_NRFX_UARTE_ENHANCED_RX=y) behaves a bit different because timeout always triggers switch of buffers which means that there will be no UART_RX_RDY events with non-zero offset. It also means that every UART_RX_RDY will be followed by UART_RX_BUF_RELEASED. After rework, driver is recommended to be used for all platforms as it performs much better and takes much less code than the second UART shim available for Nordic devices. Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
parent
d82808ea9b
commit
399a235653
|
@ -37,6 +37,18 @@ config UART_NRFX_UARTE_LEGACY_SHIM
|
|||
# New shim takes more ROM. Until it is fixed use legacy shim.
|
||||
default y
|
||||
|
||||
config UART_NRFX_UARTE_ENHANCED_RX
|
||||
bool "Enhanced RX handling"
|
||||
depends on UART_ASYNC_API
|
||||
depends on UART_NRFX_UARTE_LEGACY_SHIM
|
||||
default y if !(UART_0_NRF_HW_ASYNC || UART_1_NRF_HW_ASYNC || UART_2_NRF_HW_ASYNC)
|
||||
help
|
||||
Enable RX handling mode which is switching buffers on timeout. This is an
|
||||
enhancement compared to other two modes (default and hardware assisted).
|
||||
Default mode could miscount bytes when interrupt was not handled on time
|
||||
and hardware assisted required TIMER peripheral instance and PPI channel
|
||||
for accurate byte counting.
|
||||
|
||||
config UART_ASYNC_TX_CACHE_SIZE
|
||||
int "TX cache buffer size"
|
||||
depends on UART_ASYNC_API
|
||||
|
|
|
@ -68,6 +68,7 @@ config UART_$(nrfx_uart_num)_NRF_ASYNC_LOW_POWER
|
|||
depends on HAS_HW_NRF_UARTE$(nrfx_uart_num)
|
||||
depends on UART_ASYNC_API
|
||||
depends on UART_NRFX_UARTE_LEGACY_SHIM
|
||||
default y
|
||||
help
|
||||
When enabled, UARTE is enabled before each TX or RX usage and disabled
|
||||
when not used. Disabling UARTE while in idle allows to achieve lowest
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue