Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ADC Digi First-Order IIR Filter is Missing from V5.0 (IDFGH-9113) #10514

Closed
3 tasks done
willz1200 opened this issue Jan 10, 2023 · 2 comments
Closed
3 tasks done

ADC Digi First-Order IIR Filter is Missing from V5.0 (IDFGH-9113) #10514

willz1200 opened this issue Jan 10, 2023 · 2 comments
Assignees
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally

Comments

@willz1200
Copy link

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

General issue report

I've recently made the transition to esp-idf v5.0 and have noticed that functions such as adc_digi_filter_set_config() and adc_digi_filter_enable() have been removed now the v4.4 legacy adc driver is depreciated.

ADC IIR functions were previously available here but haven't been kept around in v5.0. This breaking change also appears to be missing from the v4.4 to v5.0 migration guide. The back end HAL functions such as adc_ll_digi_filter_set_factor still appear to be present in v5.0 here, but obviously the HAL isn't considered a stable API so this wouldn't be a long term solution.

I could do with getting the IIR filter enabled to help compensate for the ESP32-S2's known poor ADC performance. Are there any plans to add the ADC IIR filter functions into v5.0?

@espressif-bot espressif-bot added the Status: Opened Issue is new label Jan 10, 2023
@github-actions github-actions bot changed the title ADC Digi First-Order IIR Filter is Missing from V5.0 ADC Digi First-Order IIR Filter is Missing from V5.0 (IDFGH-9113) Jan 10, 2023
@willz1200
Copy link
Author

willz1200 commented Jan 10, 2023

I've enabled the ADC IIR filter using code as follows

#include "hal/adc_ll.h"
#include "hal/adc_types_private.h"

adc_ll_digi_filter_set_factor(ADC_UNIT_2, ADC_DIGI_FILTER_IIR_2);
adc_ll_digi_filter_enable(ADC_UNIT_2, true);

My application uses the adc_continuous driver sampling 3 channels at 20kHz, with 10nF decoupling for each adc pin. The data is streamed out over UDP for analysis. When switching on the IIR filter, the data clearly gets much worse, eventually containing many repeating blips in the ADC reading. Am I correct in think the IIR filter has been left out of v5.0 because the hardware doesn't function as intended? Or am I missing something in my implementation?

ADC_DIGI_FILTER_IIR Turn Off

IIR_off

ADC_DIGI_FILTER_IIR_2

IIR_2

ADC_DIGI_FILTER_IIR_4

IIR_4

ADC_DIGI_FILTER_IIR_8

IIR_8

ADC_DIGI_FILTER_IIR_16

IIR_16

ADC_DIGI_FILTER_IIR_64

IIR_64

@Icarus113
Copy link
Collaborator

Hi @willz1200 , sorry for the migration guide lacking for these filter related APIs.

The filter related APIs were added in previous IDF versions, but the API behaviours were not guaranteed.
This feature is planned as a IDF v5.1 feature. We will add the lacking migration guide later.

@espressif-bot espressif-bot added Resolution: NA Issue resolution is unavailable Status: Done Issue is done internally Resolution: Done Issue is done internally and removed Status: Opened Issue is new Resolution: NA Issue resolution is unavailable labels Feb 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally
Projects
None yet
Development

No branches or pull requests

3 participants