From 23acb4d17be66a55fd142657afea4218b2012c7e Mon Sep 17 00:00:00 2001 From: Claude Heintz Date: Thu, 22 Jun 2017 12:40:31 -0500 Subject: [PATCH] Two Stop Bit Workaround (#461) * Update esp32-hal-uart.c * Two Stop Bit Workaround see https://github.com/espressif/esp-idf/blob/master/components/driver/uart.c lines 118-127 --- cores/esp32/esp32-hal-uart.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cores/esp32/esp32-hal-uart.c b/cores/esp32/esp32-hal-uart.c index 3b81a536..4730720b 100644 --- a/cores/esp32/esp32-hal-uart.c +++ b/cores/esp32/esp32-hal-uart.c @@ -195,6 +195,13 @@ uart_t* uartBegin(uint8_t uart_nr, uint32_t baudrate, uint32_t config, int8_t rx uartSetBaudRate(uart, baudrate); UART_MUTEX_LOCK(); uart->dev->conf0.val = config; + #define TWO_STOP_BITS_CONF 0x3 + #define ONE_STOP_BITS_CONF 0x1 + + if ( uart->dev->conf0.stop_bit_num == TWO_STOP_BITS_CONF) { + uart->dev->conf0.stop_bit_num = ONE_STOP_BITS_CONF; + uart->dev->rs485_conf.dl1_en = 1; + } UART_MUTEX_UNLOCK(); if(rxPin != -1) {