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 d75f60ea7 mcu/nrf5340: Disable UART before pin configuration
d75f60ea7 is described below

commit d75f60ea774328d347dc60beb5608bf39d0f5b4b
Author: Jerzy Kasenberg <[email protected]>
AuthorDate: Tue Jan 20 08:13:33 2026 +0100

    mcu/nrf5340: Disable UART before pin configuration
    
    Code was modifying UART PSEL configuration even
    when peripheal was alreay enabled.
    
    In normal case this is not a problem since during
    hal_uart_init is called peripheral is not enabled.
    However when booloader already enabled UART and
    application tried to used peripheral with different
    pin configuration change would not be apply
    
    With this change peripheral is disabled before
    modification it will be enabled later when needed.
    
    Signed-off-by: Jerzy Kasenberg <[email protected]>
---
 hw/mcu/nordic/nrf5340/src/hal_uart.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hw/mcu/nordic/nrf5340/src/hal_uart.c 
b/hw/mcu/nordic/nrf5340/src/hal_uart.c
index e4a2dacf4..d8341cea8 100644
--- a/hw/mcu/nordic/nrf5340/src/hal_uart.c
+++ b/hw/mcu/nordic/nrf5340/src/hal_uart.c
@@ -354,6 +354,8 @@ hal_uart_init(int port, void *arg)
         assert(false);
     }
 
+    /* Disable UART for pin configuration */
+    u->nrf_uart->ENABLE = 0;
     u->nrf_uart->PSEL.TXD = cfg->suc_pin_tx;
     u->nrf_uart->PSEL.RXD = cfg->suc_pin_rx;
     u->nrf_uart->PSEL.RTS = cfg->suc_pin_rts;

Reply via email to