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

akembeddedsw
Posts: 1
Joined: Thu Sep 05, 2024 9:58 am

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

Postby akembeddedsw » Thu Sep 05, 2024 10:05 am

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

MicroController
Posts: 1688
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

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

Postby MicroController » Fri Sep 06, 2024 7:44 pm

Can you employ uart_wait_tx_done() for that?

Who is online

Users browsing this forum: No registered users and 87 guests