Skip to content

Commit

Permalink
Fixes UART MODBUS and Loopback issue (#6133)
Browse files Browse the repository at this point in the history
  • Loading branch information
SuGlider authored Jan 17, 2022
1 parent 1bbe61a commit 5ae3886
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions cores/esp32/esp32-hal-uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,6 @@ uart_t* uartBegin(uint8_t uart_nr, uint32_t baudrate, uint32_t config, int8_t rx
ESP_ERROR_CHECK(uart_set_line_inverse(uart_nr, UART_SIGNAL_TXD_INV | UART_SIGNAL_RXD_INV));
}

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

UART_MUTEX_UNLOCK();

uartFlush(uart);
Expand Down Expand Up @@ -306,7 +303,7 @@ void uartFlushTxOnly(uart_t* uart, bool txOnly)
}

UART_MUTEX_LOCK();
ESP_ERROR_CHECK(uart_wait_tx_done(uart->num, portMAX_DELAY));
while(!uart_ll_is_tx_idle(UART_LL_GET_HW(uart->num)));

if ( !txOnly ) {
ESP_ERROR_CHECK(uart_flush_input(uart->num));
Expand Down

0 comments on commit 5ae3886

Please sign in to comment.