You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by je...@apache.org on 2022/02/17 07:19:40 UTC

[mynewt-core] branch master updated: hw/mcu/dialog: Reset UART before reconfiguration

This is an automated email from the ASF dual-hosted git repository.

jerzy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
     new bf936b8  hw/mcu/dialog: Reset UART before reconfiguration
bf936b8 is described below

commit bf936b80b272d3fe446def2178d62819b59ad3d6
Author: Jerzy Kasenberg <je...@codecoup.pl>
AuthorDate: Wed Feb 16 15:42:52 2022 +0100

    hw/mcu/dialog: Reset UART before reconfiguration
    
    If TX FIFO is not empty (and maybe other conditions) during programming
    new baudare UART can endup in BUSY state that will never end.
    
    This adds reset of UART prior to configuring it in similar way as is
    already done in uart_da1469x.c
---
 hw/mcu/dialog/da1469x/src/hal_uart.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/hw/mcu/dialog/da1469x/src/hal_uart.c b/hw/mcu/dialog/da1469x/src/hal_uart.c
index 2a374e0..ef6f657 100644
--- a/hw/mcu/dialog/da1469x/src/hal_uart.c
+++ b/hw/mcu/dialog/da1469x/src/hal_uart.c
@@ -572,6 +572,10 @@ hal_uart_config(int port, int32_t baudrate, uint8_t databits, uint8_t stopbits,
          */
         da1469x_uart_set_rx_pin_as_gpio(uart);
     }
+    /* Reset UART before setting up new baudrate */
+    regs->UART2_SRR_REG = UART2_UART2_SRR_REG_UART_UR_Msk |
+                          UART2_UART2_SRR_REG_UART_RFR_Msk |
+                          UART2_UART2_SRR_REG_UART_XFR_Msk;
 
     regs->UART2_LCR_REG |= UART2_UART2_LCR_REG_UART_DLAB_Msk;
     regs->UART2_IER_DLH_REG = (baudrate_cfg >> 16) & 0xff;