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

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

commit 7e9bd5448f99347bfab2dbd0f6964e65c0830c57
Author: raiden00pl <[email protected]>
AuthorDate: Thu Sep 24 15:32:29 2026 +0200

    arm/nrf52,nrf53: fix SAADC channel limit register value
    
    CHLIMIT was written with (limith < 16) | limith, which put the high
    limit into the low field and a boolean into bit 0. Shift the high
    limit to bits 16-31 and the low limit to bits 0-15.
    
    Assisted-by: Claude Code
    Signed-off-by: raiden00pl <[email protected]>
---
 arch/arm/src/nrf52/nrf52_adc.c | 2 +-
 arch/arm/src/nrf53/nrf53_adc.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/src/nrf52/nrf52_adc.c b/arch/arm/src/nrf52/nrf52_adc.c
index deaac22e33b..c03977a780d 100644
--- a/arch/arm/src/nrf52/nrf52_adc.c
+++ b/arch/arm/src/nrf52/nrf52_adc.c
@@ -767,7 +767,7 @@ static int nrf52_adc_chancfg(struct nrf52_adc_s *priv, 
uint8_t chan,
 #ifdef CONFIG_NRF52_SAADC_LIMITS
   /* Configure limits */
 
-  regval = (cfg->limith < 16) | (cfg->limith << 0);
+  regval = ((uint32_t)cfg->limith << 16) | ((uint32_t)cfg->limitl << 0);
   nrf52_adc_putreg(priv, NRF52_SAADC_CHLIMIT_OFFSET(chan), regval);
 #endif
 
diff --git a/arch/arm/src/nrf53/nrf53_adc.c b/arch/arm/src/nrf53/nrf53_adc.c
index 289b67e1b35..2ba7c3f59ca 100644
--- a/arch/arm/src/nrf53/nrf53_adc.c
+++ b/arch/arm/src/nrf53/nrf53_adc.c
@@ -670,7 +670,7 @@ static int nrf53_adc_chancfg(struct nrf53_adc_s *priv, 
uint8_t chan,
 #ifdef CONFIG_NRF53_SAADC_LIMITS
   /* Configure limits */
 
-  regval = (cfg->limith < 16) | (cfg->limith << 0);
+  regval = ((uint32_t)cfg->limith << 16) | ((uint32_t)cfg->limitl << 0);
   nrf53_adc_putreg(priv, NRF53_SAADC_CHLIMIT_OFFSET(chan), regval);
 #endif
 

Reply via email to