[riot-notifications] [RIOT-OS/RIOT] cpu/esp32: add the new API function uart_mode to periph/uart (#11231)

Gunar Schorcht notifications at github.com
Thu Mar 28 14:26:33 CET 2019


gschorcht commented on this pull request.



> +        case UART_DATA_BITS_8: _uarts[uart].regs->conf0.bit_num = 3; break;
+        default: LOG_TAG_ERROR("uart", "invalid number of data bits\n");
+                 critical_exit();
+                 return UART_NOMODE;
+    }
+    /* store changed number of data bits in configuration */
+    _uarts[uart].data = data_bits;
+
+    /* set number of stop bits */
+    #ifdef MCU_ESP32
+    /* workaround for hardware bug when stop bits are set to 2-bit mode. */
+    switch (stop_bits) {
+        case UART_STOP_BITS_1: _uarts[uart].regs->conf0.stop_bit_num = 1;
+                               _uarts[uart].regs->rs485_conf.dl1_en = 1;
+                               break;
+        case UART_STOP_BITS_2: _uarts[uart].regs->conf0.stop_bit_num = 1;

No, it is a known hardware bug. ` _uarts[uart].regs->conf0.stop_bit_num` has to be set to `1` if there is any stop bit. With `_uarts[uart].regs->rs485_conf.dl1_en` it is decided whether there are 1 or 2 stop bits.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/11231#discussion_r269999170
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190328/e727b2be/attachment.html>


More information about the notifications mailing list