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

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit a5477dc4dc746314b4afea33195af3b55ec53028
Author: jsanchez-2g <[email protected]>
AuthorDate: Tue Aug 18 16:18:20 2026 -0500

    stm32l0: Write back SYSCFG_CFGR3 when enabling the HSI48 reference.
    
    vrefint_enable() sets SYSCFG_CFGR3_ENBUFVREFINTHSI48 in its local copy
    of the register value but never writes that value back to the hardware.
    The VREFINT reference for the HSI48 scaler is therefore never enabled.
    
    Only the earlier ENVREFINT update reaches the register, so VREFINT
    itself is enabled while the HSI48 reference is not.  HSI48 then runs
    without its voltage reference and the 48MHz clock is not accurate enough
    to be used by the USB device controller.
    
    Write the register after applying the HSI48 reference bit.
    
    Assisted-by: GitHub Copilot:claude-opus-5
    Signed-off-by: jsanchez-2g <[email protected]>
---
 arch/arm/src/stm32l0/stm32l0_rcc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/src/stm32l0/stm32l0_rcc.c 
b/arch/arm/src/stm32l0/stm32l0_rcc.c
index 3fa846122c3..a874d96650d 100644
--- a/arch/arm/src/stm32l0/stm32l0_rcc.c
+++ b/arch/arm/src/stm32l0/stm32l0_rcc.c
@@ -744,6 +744,8 @@ static void vrefint_enable(void)
   regval |= SYSCFG_CFGR3_ENBUFVREFINTHSI48;
 #endif
 
+  putreg32(regval, STM32_SYSCFG_CFGR3);
+
   /* Wait for VREFINT ready */
 
   while ((getreg32(STM32_SYSCFG_CFGR3) & SYSCFG_CFGR3_VREFINTRDYF) == 0);

Reply via email to