Merge branch 'fix/esp32_adc_continuous_loss_sample_v5.4' into 'release/v5.4'

Fix/esp32 adc continuous loss sample (v5.4)

See merge request espressif/esp-idf!42830
This commit is contained in:
Jiang Jiang Jian
2026-03-16 19:19:42 +08:00
9 changed files with 16 additions and 9 deletions
+4
View File
@@ -348,6 +348,10 @@ esp_err_t adc_continuous_start(adc_continuous_handle_t handle)
adc_hal_digi_connect(true);
adc_hal_digi_enable(true);
#if ADC_LL_DEFAULT_CONV_LIMIT_EN
adc_ll_digi_convert_limit_enable(false);
#endif
return ESP_OK;
}
+5 -2
View File
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -7,6 +7,7 @@
#pragma once
#include <stdbool.h>
#include "esp_rom_sys.h"
#include "hal/adc_types.h"
#include "hal/misc.h"
#include "hal/assert.h"
@@ -45,7 +46,7 @@ extern "C" {
//On esp32, ADC can only be continuously triggered when `ADC_LL_DEFAULT_CONV_LIMIT_EN == 1`, `ADC_LL_DEFAULT_CONV_LIMIT_NUM != 0`
#define ADC_LL_DEFAULT_CONV_LIMIT_EN 1
#define ADC_LL_DEFAULT_CONV_LIMIT_NUM 10
#define ADC_LL_DEFAULT_CONV_LIMIT_NUM 255
/*---------------------------------------------------------------
PWDET (Power Detect)
@@ -155,6 +156,8 @@ static inline void adc_ll_digi_set_convert_limit_num(uint32_t meas_num)
*/
static inline void adc_ll_digi_convert_limit_enable(bool enable)
{
//ESP32 has a hardware limitaton, meas_num_limit can only be cleared after ADC enters sample phase(10~15us after start)
esp_rom_delay_us(60);
SYSCON.saradc_ctrl2.meas_num_limit = enable;
}
+1 -1
View File
@@ -58,7 +58,7 @@ extern "C" {
#define ADC_LL_CLKM_DIV_B_DEFAULT 1
#define ADC_LL_CLKM_DIV_A_DEFAULT 0
#define ADC_LL_DEFAULT_CONV_LIMIT_EN 0
#define ADC_LL_DEFAULT_CONV_LIMIT_NUM 10
#define ADC_LL_DEFAULT_CONV_LIMIT_NUM 255
/**
* Workaround: on ESP32C3, the internal hardware counter that counts ADC samples will not be automatically cleared,
+1 -1
View File
@@ -59,7 +59,7 @@ extern "C" {
#define ADC_LL_CLKM_DIV_B_DEFAULT 1
#define ADC_LL_CLKM_DIV_A_DEFAULT 0
#define ADC_LL_DEFAULT_CONV_LIMIT_EN 0
#define ADC_LL_DEFAULT_CONV_LIMIT_NUM 10
#define ADC_LL_DEFAULT_CONV_LIMIT_NUM 255
#define ADC_LL_POWER_MANAGE_SUPPORTED 1 //ESP32C5 supported to manage power mode
/*---------------------------------------------------------------
+1 -1
View File
@@ -59,7 +59,7 @@ extern "C" {
#define ADC_LL_CLKM_DIV_B_DEFAULT 1
#define ADC_LL_CLKM_DIV_A_DEFAULT 0
#define ADC_LL_DEFAULT_CONV_LIMIT_EN 0
#define ADC_LL_DEFAULT_CONV_LIMIT_NUM 10
#define ADC_LL_DEFAULT_CONV_LIMIT_NUM 255
#define ADC_LL_POWER_MANAGE_SUPPORTED 1 //ESP32C6 supported to manage power mode
/*---------------------------------------------------------------
+1 -1
View File
@@ -59,7 +59,7 @@ extern "C" {
#define ADC_LL_CLKM_DIV_B_DEFAULT 1
#define ADC_LL_CLKM_DIV_A_DEFAULT 0
#define ADC_LL_DEFAULT_CONV_LIMIT_EN 0
#define ADC_LL_DEFAULT_CONV_LIMIT_NUM 10
#define ADC_LL_DEFAULT_CONV_LIMIT_NUM 255
#define ADC_LL_POWER_MANAGE_SUPPORTED 1 //ESP32H2 supported to manage power mode
/*---------------------------------------------------------------
+1 -1
View File
@@ -56,7 +56,7 @@ extern "C" {
#define ADC_LL_CLKM_DIV_B_DEFAULT 1
#define ADC_LL_CLKM_DIV_A_DEFAULT 0
#define ADC_LL_DEFAULT_CONV_LIMIT_EN 0
#define ADC_LL_DEFAULT_CONV_LIMIT_NUM 10
#define ADC_LL_DEFAULT_CONV_LIMIT_NUM 255
#define ADC_LL_POWER_MANAGE_SUPPORTED 1 //ESP32P4 supported to manage power mode
/*---------------------------------------------------------------
+1 -1
View File
@@ -58,7 +58,7 @@ extern "C" {
#define ADC_LL_CLKM_DIV_B_DEFAULT 1
#define ADC_LL_CLKM_DIV_A_DEFAULT 0
#define ADC_LL_DEFAULT_CONV_LIMIT_EN 0
#define ADC_LL_DEFAULT_CONV_LIMIT_NUM 10
#define ADC_LL_DEFAULT_CONV_LIMIT_NUM 255
/*---------------------------------------------------------------
PWDET (Power Detect)
+1 -1
View File
@@ -60,7 +60,7 @@ extern "C" {
#define ADC_LL_CLKM_DIV_B_DEFAULT 1
#define ADC_LL_CLKM_DIV_A_DEFAULT 0
#define ADC_LL_DEFAULT_CONV_LIMIT_EN 0
#define ADC_LL_DEFAULT_CONV_LIMIT_NUM 10
#define ADC_LL_DEFAULT_CONV_LIMIT_NUM 255
/*---------------------------------------------------------------
PWDET (Power Detect)