Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c2c8d18

Browse filesBrowse files
authored
Forces UART Flush() to wait until all bits are sent (espressif#6026)
HardwareSerial flush() was returning before all data was sent out through serial port. This is a problem to some RS485 libraries that depend on it to signaling. This PR solves the issue by forcing it to block flush() until all data is sent.
1 parent 39b9e1e commit c2c8d18
Copy full SHA for c2c8d18

File tree

Expand file treeCollapse file tree

1 file changed

+3
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-0
lines changed

‎cores/esp32/esp32-hal-uart.c

Copy file name to clipboardExpand all lines: cores/esp32/esp32-hal-uart.c
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,9 @@ uart_t* uartBegin(uint8_t uart_nr, uint32_t baudrate, uint32_t config, int8_t rx
140140
ESP_ERROR_CHECK(uart_set_line_inverse(uart_nr, UART_SIGNAL_TXD_INV | UART_SIGNAL_RXD_INV));
141141
}
142142

143+
// Set RS485 half duplex mode on UART. This shall force flush to wait up to sending all bits out
144+
ESP_ERROR_CHECK(uart_set_mode(uart_nr, UART_MODE_RS485_HALF_DUPLEX));
145+
143146
UART_MUTEX_UNLOCK();
144147

145148
uartFlush(uart);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.