mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-30 10:47:19 +02:00
freemodbus: fix rts enable fail when transmit frame
This commit is contained in:
@ -37,7 +37,7 @@
|
|||||||
#define MB_SERIAL_BUF_SIZE (CONFIG_FMB_SERIAL_BUF_SIZE)
|
#define MB_SERIAL_BUF_SIZE (CONFIG_FMB_SERIAL_BUF_SIZE)
|
||||||
|
|
||||||
// common definitions for serial port implementations
|
// common definitions for serial port implementations
|
||||||
#define MB_SERIAL_TX_TOUT_MS (100)
|
#define MB_SERIAL_TX_TOUT_MS (2200) // maximum time for transmission of longest allowed frame buffer
|
||||||
#define MB_SERIAL_TX_TOUT_TICKS pdMS_TO_TICKS(MB_SERIAL_TX_TOUT_MS) // timeout for transmission
|
#define MB_SERIAL_TX_TOUT_TICKS pdMS_TO_TICKS(MB_SERIAL_TX_TOUT_MS) // timeout for transmission
|
||||||
#define MB_SERIAL_RX_TOUT_MS (1)
|
#define MB_SERIAL_RX_TOUT_MS (1)
|
||||||
#define MB_SERIAL_RX_TOUT_TICKS pdMS_TO_TICKS(MB_SERIAL_RX_TOUT_MS) // timeout for receive
|
#define MB_SERIAL_RX_TOUT_TICKS pdMS_TO_TICKS(MB_SERIAL_RX_TOUT_MS) // timeout for receive
|
||||||
|
@ -119,7 +119,7 @@ BOOL xMBPortSerialTxPoll(void)
|
|||||||
}
|
}
|
||||||
ESP_LOGD(TAG, "MB_TX_buffer send: (%d) bytes\n", (uint16_t)usCount);
|
ESP_LOGD(TAG, "MB_TX_buffer send: (%d) bytes\n", (uint16_t)usCount);
|
||||||
// Waits while UART sending the packet
|
// Waits while UART sending the packet
|
||||||
esp_err_t xTxStatus = uart_wait_tx_idle_polling(ucUartNumber);
|
esp_err_t xTxStatus = uart_wait_tx_done(ucUartNumber, MB_SERIAL_TX_TOUT_TICKS);
|
||||||
vMBPortSerialEnable(TRUE, FALSE);
|
vMBPortSerialEnable(TRUE, FALSE);
|
||||||
MB_PORT_CHECK((xTxStatus == ESP_OK), FALSE, "mb serial sent buffer failure.");
|
MB_PORT_CHECK((xTxStatus == ESP_OK), FALSE, "mb serial sent buffer failure.");
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -113,7 +113,7 @@ BOOL xMBMasterPortSerialTxPoll(void)
|
|||||||
}
|
}
|
||||||
ESP_LOGD(TAG, "MB_TX_buffer sent: (%d) bytes.", (uint16_t)(usCount - 1));
|
ESP_LOGD(TAG, "MB_TX_buffer sent: (%d) bytes.", (uint16_t)(usCount - 1));
|
||||||
// Waits while UART sending the packet
|
// Waits while UART sending the packet
|
||||||
esp_err_t xTxStatus = uart_wait_tx_idle_polling(ucUartNumber);
|
esp_err_t xTxStatus = uart_wait_tx_done(ucUartNumber, MB_SERIAL_TX_TOUT_TICKS);
|
||||||
vMBMasterPortSerialEnable(TRUE, FALSE);
|
vMBMasterPortSerialEnable(TRUE, FALSE);
|
||||||
MB_PORT_CHECK((xTxStatus == ESP_OK), FALSE, "mb serial sent buffer failure.");
|
MB_PORT_CHECK((xTxStatus == ESP_OK), FALSE, "mb serial sent buffer failure.");
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
Reference in New Issue
Block a user