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 16e3c8c6deaaa6daab9c8e9ed9389c09faf6a843
Author: jsanchez-2g <[email protected]>
AuthorDate: Tue Aug 18 14:34:15 2026 -0500

    stm32l0: Enable SYSCFG clock when VREFINT is enabled.
    
    The SYSCFG peripheral clock was gated on CONFIG_STM32_SYSCFG, but that
    symbol is not defined by the STM32L0 Kconfig (only stm32h7 declares it),
    so RCC_APB2ENR_SYSCFGEN was never set on this chip.
    
    With SYSCFG unclocked every write performed by vrefint_enable() is
    discarded and SYSCFG_CFGR3 reads back as 0x00000000.  VREFINT and, in
    particular, the ENBUFVREFINTHSI48 reference for the HSI48 oscillator are
    therefore never enabled.  HSI48 still reports HSI48RDY, but it runs
    without its voltage reference and the 48MHz clock supplied to the USB
    device controller is unusable: the controller cannot sample the bus,
    never latches a reset condition in USB_ISTR, and never raises its
    interrupt.  The result is a USB device that is configured correctly in
    every visible register yet never enumerates.
    
    VREFINT is configured exclusively through SYSCFG_CFGR3, so enable the
    SYSCFG clock whenever CONFIG_STM32_VREFINT is selected.
    
    Observed on NUCLEO-L073RZ (STM32L073RZ):
    
      before: SYSCFG_CFGR3 = 0x00000000, no enumeration
      after:  SYSCFG_CFGR3 non-zero, device enumerates as CDC/ACM
    
    Assisted-by: GitHub Copilot:claude-opus-5
    Signed-off-by: jsanchez-2g <[email protected]>
---
 arch/arm/src/stm32l0/stm32l0_rcc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/arm/src/stm32l0/stm32l0_rcc.c 
b/arch/arm/src/stm32l0/stm32l0_rcc.c
index 10f32d300bb..3fa846122c3 100644
--- a/arch/arm/src/stm32l0/stm32l0_rcc.c
+++ b/arch/arm/src/stm32l0/stm32l0_rcc.c
@@ -319,7 +319,9 @@ static inline void rcc_enableapb2(void)
 
   regval = getreg32(STM32_RCC_APB2ENR);
 
-#ifdef CONFIG_STM32_SYSCFG
+  /* VREFINT is configured through SYSCFG_CFGR3, so its clock is required */
+
+#if defined(CONFIG_STM32_SYSCFG) || defined(CONFIG_STM32_VREFINT)
   /* SYSCFG clock */
 
   regval |= RCC_APB2ENR_SYSCFGEN;

Reply via email to