mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'bugfix/fix_modbus_rs485_rts_en_fail_v40' into 'release/v4.0'
Bugfix/fix modbus rs485 rts en fail (backport v4.0) See merge request espressif/esp-idf!14472
This commit is contained in:
commit
fb0c3e8016
@ -1094,8 +1094,9 @@ esp_err_t uart_wait_tx_done(uart_port_t uart_num, TickType_t ticks_to_wait)
|
||||
xSemaphoreGive(p_uart_obj[uart_num]->tx_mux);
|
||||
return ESP_OK;
|
||||
}
|
||||
uart_enable_intr_mask(uart_num, UART_TX_DONE_INT_ENA_M);
|
||||
|
||||
UART_ENTER_CRITICAL_ISR(&uart_spinlock[uart_num]);
|
||||
SET_PERI_REG_MASK(UART_INT_ENA_REG(uart_num), UART_TX_DONE_INT_ENA_M);
|
||||
UART_EXIT_CRITICAL_ISR(&uart_spinlock[uart_num]);
|
||||
TickType_t ticks_end = xTaskGetTickCount();
|
||||
if (ticks_end - ticks_start > ticks_to_wait) {
|
||||
ticks_to_wait = 0;
|
||||
@ -1105,7 +1106,7 @@ esp_err_t uart_wait_tx_done(uart_port_t uart_num, TickType_t ticks_to_wait)
|
||||
//take 2nd tx_done_sem, wait given from ISR
|
||||
res = xSemaphoreTake(p_uart_obj[uart_num]->tx_done_sem, (portTickType)ticks_to_wait);
|
||||
if(res == pdFALSE) {
|
||||
uart_disable_intr_mask(uart_num, UART_TX_DONE_INT_ENA_M);
|
||||
// The TX_DONE interrupt will be disabled in ISR
|
||||
xSemaphoreGive(p_uart_obj[uart_num]->tx_mux);
|
||||
return ESP_ERR_TIMEOUT;
|
||||
}
|
||||
|
@ -62,7 +62,7 @@
|
||||
|
||||
// Set buffer size for transmission
|
||||
#define MB_SERIAL_BUF_SIZE (CONFIG_FMB_SERIAL_BUF_SIZE)
|
||||
#define MB_SERIAL_TX_TOUT_MS (100)
|
||||
#define MB_SERIAL_TX_TOUT_MS (2200)
|
||||
#define MB_SERIAL_TX_TOUT_TICKS pdMS_TO_TICKS(MB_SERIAL_TX_TOUT_MS) // timeout for transmission
|
||||
|
||||
/* ----------------------- Static variables ---------------------------------*/
|
||||
|
Loading…
Reference in New Issue
Block a user