Page 1 of 1

How to have something similar to "uart_write_bytes" but with timeout?

Posted: Thu Sep 05, 2024 10:05 am
by akembeddedsw
Hi,

I'm trying to send some data using UART with the following config

const uart_config_t uart_config = {
.baud_rate = BMS_BAUD_RATE,
.data_bits = UART_DATA_8_BITS,
.parity = UART_PARITY_DISABLE,
.stop_bits = UART_STOP_BITS_1,
.flow_ctrl = UART_HW_FLOWCTRL_CTS_RTS,
.rx_flow_ctrl_thresh = 122,
.source_clk = UART_SCLK_APB,
};

However, when the target is not available to put CTS to low, the uart_write_bytes will wait for "portMAX_DELAY".
This is causing my tasks to get stuck and my queues not to be emptied.

I'm looking for a way to send uart bytes but with timeout.

Any suggestions?

Thanks

Re: How to have something similar to "uart_write_bytes" but with timeout?

Posted: Fri Sep 06, 2024 7:44 pm
by MicroController
Can you employ uart_wait_tx_done() for that?