Hi,
I've been trying to set up UART communication with external device using uart3 instance and have so far failed.
The scenario requires sending 5 bytes to the device, receiving 1 byte confirmation, then another 5 byte request and receiving indeterminate amount of data (though about 75 bytes).
So I set up my overlay to enable uart3:
&pinctrl { uart3_default: uart3_default { group1 { psels = <NRF_PSEL(UART_TX, 0, 13)>, <NRF_PSEL(UART_RX, 0, 10)>; }; }; }; &uart3 { status = "okay"; current-speed = <2400>; parity = "even"; stop-bits = "1"; data-bits = <8>; pinctrl-0 = <&uart3_default>; pinctrl-names = "default"; };
then, in prj.conf:
#UART CONFIG_SERIAL=y CONFIG_UART_ASYNC_API=y CONFIG_UART_LINE_CTRL=n CONFIG_UART_USE_RUNTIME_CONFIGURE=y
When I run the code (using asynchronous API), after 1st req-ack I get proper UART operation as per observed events:
events generated on tmo = 100 total_rcved_len = 1 uart_rx_rdy_evt = 1 uart_rx_buf_req_evt = 2 uart_tx_done_evt = 1 uart_tx_aborted_evt = 0 uart_rx_stopped_evt = 0 --uart_rx_stopped_overrun = 0 --uart_rx_stopped_parity = 0 --uart_rx_stopped_framing = 0 --uart_rx_stopped_break_condition = 0 --uart_rx_stopped_collision = 0 --uart_rx_stopped_noise = 0 --uart_rx_stopped_other = 0 uart_rx_disabled_evt = 0
Then moving to next cycle of req-data i get following events (counted as increment of previous values):
events generated on tmo = 100 total_rcved_len = 38 uart_rx_rdy_evt = 13 uart_rx_buf_req_evt = 15 uart_tx_done_evt = 2 uart_tx_aborted_evt = 0 uart_rx_stopped_evt = 59 --uart_rx_stopped_overrun = 0 --uart_rx_stopped_parity = 0 --uart_rx_stopped_framing = 0 --uart_rx_stopped_break_condition = 0 --uart_rx_stopped_collision = 0 --uart_rx_stopped_noise = 0 --uart_rx_stopped_other = 59 uart_rx_disabled_evt = 9
Given that UART settings are correct (8e1@2400, no line control), and I was able to verify with oscilloscope that data is sent correctly from outside device, I think that something is missing either in my conf or overlay though I fail to see what could that be. Additionally, when setting CONFIG_UART_USE_RUNTIME_CONFIGURE=n and removing uart_configure() call from code no transmission occurs as far as I can tell, which as I understand should not be the case as overlay provides necessary configuration making uart_configure() redundant.
UART0 is used as logger backend. Tuning timeouts doesn't help, buffers are sized 256 so no overflow is possible.
Any help is appreciated.