zephyr/drivers/serial
Marc Reilly cf7dd4981f drivers: serial: nrf uarte: avoid dropping RX chars/overruns
In some cases (eg at high baud rate, no HW flow control, and when BLE
radio/ints running) data could be lost between when enough characters
have been RX'd to fill the DMA buffer and when the ENDRX event was
fired, where the the STARTRX task is invoked to start filling the next
buffer (which is set up earlier, but I think will not be filled until
STARTRX).
To fix this, the SHORT is enabled between ENDRX and STARTRX whenever the
'next' buffer is available, so that STARTRX is invoked automatically and
subsequent chars go into the next buffer via EasyDMA.
To make this work properly, uarte_nrfx_isr_async() now handles the ENDRX
event _before_ the STARTRX event.

There was also an issue in rx_timeout() where the received character
count (rx_total_byte_count) could be incremented greater than the actual
buffer size. This arises from rx_total_byte_count value coming from the
counting the RXDRDY events (either by PPI/timer counter or counting the
RXDRDY ints themselves) and so if chars are received in the rx_timeout()
(or before ENDRX is handled) the rx_timeout() could increment rx_offset
past the length of the buffer. This could result the remaining 'len'
being calculated incorrectly (an underflow due to unsigned - signed ,
where signed > unsigned).
To fix this, we now store the lengths of the buffers and don't invoke
the UART_RX_RDY callback when the buffers are full; its handled by
ENDRX.
(Also note that the buffer size should be available via the RXD.MAXCNT
register on the nrf, but this register is not exposed through the nrfx
HAL and is also double buffered, so it seemed clearer to just track the
buffer lengths explicitly here in the driver).

Signed-off-by: Marc Reilly <marc@cpdesign.com.au>

for fixup

Signed-off-by: Marc Reilly <marc@cpdesign.com.au>
2020-04-22 12:27:32 +02:00
..
CMakeLists.txt driver: uart: ns16550: convert to DT_INST_* 2020-03-14 02:22:05 +02:00
Kconfig kernel/timeout: Make timeout arguments an opaque type 2020-03-31 19:40:47 -04:00
Kconfig.altera_jtag kconfig: Turn pointless/confusing 'menuconfig's into 'config's 2019-10-22 13:53:06 -05:00
Kconfig.cc13xx_cc26xx kconfig: Clean up header comments and make them consistent 2019-11-04 17:31:27 -05:00
Kconfig.cc32xx kconfig: Turn pointless/confusing 'menuconfig's into 'config's 2019-10-22 13:53:06 -05:00
Kconfig.cmsdk_apb kconfig: Clean up header comments and make them consistent 2019-11-04 17:31:27 -05:00
Kconfig.esp32 kconfig: Turn pointless/confusing 'menuconfig's into 'config's 2019-10-22 13:53:06 -05:00
Kconfig.gecko kconfig: Clean up header comments and make them consistent 2019-11-04 17:31:27 -05:00
Kconfig.imx drivers: serial: uart_imx: Convert driver to new DT_INST macros 2020-04-04 09:34:00 -05:00
Kconfig.leuart_gecko kconfig: Clean up header comments and make them consistent 2019-11-04 17:31:27 -05:00
Kconfig.litex kconfig: Clean up header comments and make them consistent 2019-11-04 17:31:27 -05:00
Kconfig.mcux drivers: serial: uart_mcux: Convert to DT_INST 2020-04-14 17:52:31 -05:00
Kconfig.mcux_flexcomm kconfig: Replace non-defconfig single-symbol 'if's with 'depends on' 2020-02-12 10:32:34 -06:00
Kconfig.mcux_lpsci kconfig: Clean up header comments and make them consistent 2019-11-04 17:31:27 -05:00
Kconfig.mcux_lpuart drivers: uart: mcux_lpuart: Convert to DT_INST 2020-04-20 15:50:45 -05:00
Kconfig.miv drivers: uart: miv: convert to DT_INST defines 2020-03-11 16:37:22 -06:00
Kconfig.msp432p4xx kconfig: Turn pointless/confusing 'menuconfig's into 'config's 2019-10-22 13:53:06 -05:00
Kconfig.native_posix dts: posix: Add DTS support for POSIX architecture 2019-05-28 21:14:19 -04:00
Kconfig.nrfx drivers: nrf: Remove no longer suitable dependencies on Kconfig options 2020-04-03 14:47:32 +02:00
Kconfig.ns16550 driver: uart: ns16550: convert to DT_INST_* 2020-03-14 02:22:05 +02:00
Kconfig.nsim license: cleanup: add SPDX Apache-2.0 license identifier 2019-04-07 08:45:22 -04:00
Kconfig.pl011 drivers: serial: uart_pl011: remove shared irq support 2020-03-25 08:34:40 -05:00
Kconfig.psoc6 kconfig: Clean up header comments and make them consistent 2019-11-04 17:31:27 -05:00
Kconfig.rtt kconfig: Clean up header comments and make them consistent 2019-11-04 17:31:27 -05:00
Kconfig.rv32m1_lpuart kconfig: Clean up header comments and make them consistent 2019-11-04 17:31:27 -05:00
Kconfig.sam0 kconfig: Clean up header comments and make them consistent 2019-11-04 17:31:27 -05:00
Kconfig.sifive uart: sifive: fix interrupt-driven transmission 2020-03-24 13:28:58 -04:00
Kconfig.stellaris arm: Removed support for CC2650 2020-01-18 09:27:55 -06:00
Kconfig.stm32 boards: stm32: Use dt API for serial peripheral configuration 2020-04-20 15:27:56 -05:00
Kconfig.uart_sam drivers: serial: uart_sam: rework device tree support 2020-04-18 17:04:08 -05:00
Kconfig.usart_sam drivers: serial: usart_sam: rework device tree support 2020-04-18 17:04:08 -05:00
Kconfig.xlnx kconfig: Clean up header comments and make them consistent 2019-11-04 17:31:27 -05:00
leuart_gecko.c drivers: silabs: Convert silabs drivers to new DT_INST macros 2020-03-26 05:26:23 -05:00
uart_altera_jtag_hal.c cleanup: include/: move uart.h to drivers/uart.h 2019-06-27 22:55:49 -04:00
uart_cc13xx_cc26xx.c drivers: cc13xx_cc26xx: guard references to sleep states 2020-03-31 07:38:31 -05:00
uart_cc32xx.c driver: uart: make deprecation effective 2019-11-07 12:44:15 -06:00
uart_cmsdk_apb.c drivers: arm_cmsdk/arm: Convert drivers to new DT_INST macros 2020-03-31 19:28:47 -05:00
uart_esp32.c drivers: esp32: Convert esp32 drivers to new DT_INST macros 2020-03-26 08:49:11 -05:00
uart_gecko.c drivers: silabs: Convert silabs drivers to new DT_INST macros 2020-03-26 05:26:23 -05:00
uart_handlers.c drivers: uart: Add uart_configure verification handler 2020-03-23 15:23:50 -04:00
uart_imx.c drivers: serial: uart_imx: Convert driver to new DT_INST macros 2020-04-04 09:34:00 -05:00
uart_liteuart.c drivers: litex: Convert litex drivers to new DT_INST macros 2020-03-30 12:49:43 -05:00
uart_mcux.c drivers: serial: uart_mcux: Convert to DT_INST 2020-04-14 17:52:31 -05:00
uart_mcux_flexcomm.c drivers: serial: Use generated dts macros in mcux flexcomm driver 2019-12-13 18:45:54 +01:00
uart_mcux_lpsci.c drivers: serial: Refactor mcux lpsci driver to use generated dts macros 2020-01-15 18:02:19 -05:00
uart_mcux_lpuart.c drivers: serial: mcux_lpuart: fix infinite loop 2020-04-21 06:37:10 -05:00
uart_miv.c drivers: uart: uart_miv: Convert to new DT_INST macros 2020-03-28 10:18:02 -05:00
uart_msp432p4xx.c drivers: uart: uart_msp432p4xx: Convert to new DT_INST macros 2020-03-30 13:11:55 -05:00
uart_native_posix.c drivers: serial: uart_native_posix: Convert to new DT_INST macros 2020-03-27 04:55:43 -05:00
uart_nrfx_uart.c timeout: Fix up API usage 2020-03-31 19:40:47 -04:00
uart_nrfx_uarte.c drivers: serial: nrf uarte: avoid dropping RX chars/overruns 2020-04-22 12:27:32 +02:00
uart_ns16550.c global: Replace BUILD_ASSERT_MSG() with BUILD_ASSERT() 2020-03-31 07:18:06 +02:00
uart_ns16550.h drivers: serial: ns16550: move header from /include/ 2019-06-25 15:27:00 -04:00
uart_ns16550_port_x.h global: Replace BUILD_ASSERT_MSG() with BUILD_ASSERT() 2020-03-31 07:18:06 +02:00
uart_nsim.c drivers: uart: uart_nsim: Convert to new DT_INST macros 2020-03-30 13:13:20 -05:00
uart_pl011.c drivers: arm_cmsdk/arm: Convert drivers to new DT_INST macros 2020-03-31 19:28:47 -05:00
uart_psoc6.c cleanup: include/: move misc/__assert.h to sys/__assert.h 2019-06-27 22:55:49 -04:00
uart_rtt.c drivers: uart_rtt: Handle PM callback properly 2019-12-18 12:10:19 +01:00
uart_rv32m1_lpuart.c drivers: serial: rv32m1_lpuart: Convert driver to new DT_INST macros 2020-04-10 14:38:04 -05:00
uart_sam.c drivers: serial: uart_sam: rework device tree support 2020-04-18 17:04:08 -05:00
uart_sam0.c drivers: serial: uart_sam0: Fix build error with CONFIG_UART_ASYNC_API 2020-04-21 08:00:49 -05:00
uart_sifive.c drivers: serial: sifive: use DT_INST_LABEL macro 2020-04-02 16:54:43 -05:00
uart_stellaris.c drivers: stellaris: Convert stellaris drivers to new DT_INST macros 2020-03-26 03:39:11 -05:00
uart_stm32.c drivers/serial: stm32: Remove calls to CONFIG_LPUART_1 2020-04-20 15:27:56 -05:00
uart_stm32.h drivers: serial: stm32: dts binding, and fixup for flow control 2019-04-17 16:09:54 -05:00
uart_xlnx_ps.c drivers: uart: uart_xlnx_ps: Convert to new DT_INST macros 2020-03-30 14:48:09 -05:00
usart_sam.c drivers: serial: usart_sam: rework device tree support 2020-04-18 17:04:08 -05:00