mirror of
https://github.com/espressif/esp-idf.git
synced 2025-10-18 17:38:09 +00:00
adc: no longer support adc2 continuous mode on esp32c3
Due to HW limitation, we don't support this anymore. On c3, ADC2 under continuous mode is not stable. However, you can enable CONFIG_ADC_CONTINUOUS_FORCE_USE_ADC2_ON_C3_S3 to force use ADC2. Refer to errata to know more details: https://www.espressif.com/sites/default/files/documentation/esp32-c3_errata_en.pdf
This commit is contained in:
@@ -576,6 +576,21 @@ esp_err_t adc_digi_controller_config(const adc_digi_config_t *config)
|
||||
}
|
||||
ADC_CHECK(config->sample_freq_hz <= SOC_ADC_SAMPLE_FREQ_THRES_HIGH && config->sample_freq_hz >= SOC_ADC_SAMPLE_FREQ_THRES_LOW, "ADC sampling frequency out of range", ESP_ERR_INVALID_ARG);
|
||||
|
||||
#if !CONFIG_ADC_CONTINUOUS_FORCE_USE_ADC2_ON_C3_S3
|
||||
for (int i = 0; i < config->adc_pattern_len; i++) {
|
||||
if (config->adc_pattern[i].unit == ADC_NUM_2) {
|
||||
//we add this error log to hint users what happened
|
||||
ESP_LOGE(ADC_TAG, "ADC2 continuous mode is no longer supported, please use ADC1. Search for errata on espressif website for more details. You can enable CONFIG_ADC_CONTINUOUS_FORCE_USE_ADC2_ON_C3_S3 to force use ADC2");
|
||||
/**
|
||||
* On all continuous mode supported chips, we will always check the unit to see if it's a continuous mode supported unit.
|
||||
* However, on ESP32C3 and ESP32S3, we will jump this check, if `CONFIG_ADC_CONTINUOUS_FORCE_USE_ADC2_ON_C3_S3` is enabled.
|
||||
*/
|
||||
ESP_LOGE(ADC_TAG, "Only support using ADC1 DMA mode");
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
}
|
||||
#endif //#if !CONFIG_ADC_CONTINUOUS_FORCE_USE_ADC2_ON_C3_S3
|
||||
|
||||
s_adc_digi_ctx->digi_controller_config.conv_limit_en = config->conv_limit_en;
|
||||
s_adc_digi_ctx->digi_controller_config.conv_limit_num = config->conv_limit_num;
|
||||
s_adc_digi_ctx->digi_controller_config.adc_pattern_len = config->adc_pattern_len;
|
||||
|
Reference in New Issue
Block a user