From cd58323541fdb87be0fcf01469798a6c3e0f33f1 Mon Sep 17 00:00:00 2001 From: bunnie Date: Thu, 14 Aug 2025 14:10:26 +0800 Subject: [PATCH] fix uart divider commit needs to disable uart before the new values can take --- libs/cramium-hal/src/udma/uart.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libs/cramium-hal/src/udma/uart.rs b/libs/cramium-hal/src/udma/uart.rs index f83be9a89..041d68432 100644 --- a/libs/cramium-hal/src/udma/uart.rs +++ b/libs/cramium-hal/src/udma/uart.rs @@ -107,6 +107,10 @@ impl Uart { pub fn set_baud(&self, baud: u32, clk_freq: u32) { let clk_counter: u32 = (clk_freq + baud / 2) / baud; + // must disable the UART before adjusting any values + unsafe { + self.csr.base().add(Bank::Custom.into()).add(UartReg::Setup.into()).write_volatile(0x0); + } // setup baud, bits, parity, etc. // safety: this is safe to call as long as the base address points at a valid UART. unsafe {