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

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


The following commit(s) were added to refs/heads/master by this push:
     new 55a2ddbe50c arch/arm/src/common/stm32: wait 20 us for the G4 ADC 
voltage regulator
55a2ddbe50c is described below

commit 55a2ddbe50c2c9645fcde90732573a63419d3f70
Author: Daniel P. Carvalho <[email protected]>
AuthorDate: Sun Oct 25 12:04:10 2026 -0300

    arch/arm/src/common/stm32: wait 20 us for the G4 ADC voltage regulator
    
    The ADC calibration was started 10 us after enabling the voltage
    regulator, but the STM32G4 datasheet gives tADCVREG_STUP as 20 us at most
    (DS12288, table "ADC characteristics"), so a calibration could begin
    before the regulator was ready.  Wait 20 us on the G4 and keep the 10 us
    for the other chips that share this code.
    
    Assisted-by: Claude Code:claude-sonnet-5-5
    Signed-off-by: Daniel P. Carvalho <[email protected]>
---
 arch/arm/src/common/stm32/stm32_adc_m3m4_v1v2.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/arch/arm/src/common/stm32/stm32_adc_m3m4_v1v2.c 
b/arch/arm/src/common/stm32/stm32_adc_m3m4_v1v2.c
index dfb6c4fb4af..2246438925e 100644
--- a/arch/arm/src/common/stm32/stm32_adc_m3m4_v1v2.c
+++ b/arch/arm/src/common/stm32/stm32_adc_m3m4_v1v2.c
@@ -2608,6 +2608,15 @@ static void adc_mode_cfg(struct stm32_dev_s *priv)
  ****************************************************************************/
 
 #if defined(HAVE_IP_ADC_V2)
+
+/* ADC voltage regulator start-up time (tADCVREG_STUP) */
+
+#  ifdef CONFIG_STM32_STM32G4XXX
+#    define ADC_VREG_STARTUP_US 20
+#  else
+#    define ADC_VREG_STARTUP_US 10
+#  endif
+
 static void adc_voltreg_cfg(struct stm32_dev_s *priv)
 {
   /* Set ADC voltage regulator to intermediate state */
@@ -2622,7 +2631,7 @@ static void adc_voltreg_cfg(struct stm32_dev_s *priv)
 
   /* Wait for the ADC voltage regulator to startup */
 
-  up_udelay(10);
+  up_udelay(ADC_VREG_STARTUP_US);
 }
 #else
 static void adc_voltreg_cfg(struct stm32_dev_s *priv)

Reply via email to