ESP-IDF blocking and context switch with UART?

deadbeef
Posts: 1
Joined: Mon Jan 15, 2024 7:22 pm

ESP-IDF blocking and context switch with UART?

Postby deadbeef » Mon Jan 15, 2024 8:29 pm

I'm unclear on some really basic concepts in ESP-IDF. If a call to an ESP-IDF function with a timeout is made, will another task run while the call is blocked?

Specifically a library I'm using calls the ESP-IDF function:

Code: Select all

int uart_read_bytes(uart_port_t uart_num, void* buf, uint32_t length, TickType_t ticks_to_wait);
with a long timeout. I thought my other tasks would run but they are not. Note there is no hardware flow control on the UART - would that make a difference?

ESP-IDF doc: uart_read_bytes

ESP_Sprite
Posts: 9730
Joined: Thu Nov 26, 2015 4:08 am

Re: ESP-IDF blocking and context switch with UART?

Postby ESP_Sprite » Tue Jan 16, 2024 1:24 am

Yep. Blocking calls allow FreeRTOS to run other tasks, so it's perfectly OK to have long blocking calls. Not sure why your other tasks aren't running; I'd have to take a look at the code to figure that out.

Who is online

Users browsing this forum: Google [Bot] and 77 guests