Page 1 of 1

Bug in adc_set_clk_div() : Clock for adc1 is fixed

Posted: Wed Sep 21, 2022 12:13 am
by alejol
I use ESP32 board in the Arduino IDE.
I try to sample channels using ADC1. Need fast analog to digital conversion inside a timer interrupt routine.

First, i have used Arduino's analogRead() function. This takes about 80 microseconds per conversion.
Then, i used adc1_get_raw(ADC1_CHANNEL_0). This work a bit faster, 42 microseconds.

Then, when try to use analogSetClockDiv(clockDiv) or adc_set_clk_div(clockDiv) nothing changes, the conversion takes the same time.
No matter what value clockDiv has.

I think is a bug in Espressif files .

Maybe someone can tell me how to change the clock of the analog to digital converter. Maybe setting processor's registers directly.

Thanks in advance!

Re: Bug in adc_set_clk_div() : Clock for adc1 is fixed

Posted: Wed Sep 21, 2022 9:35 am
by trustmiao
i believe it is partly related to the dma, try this https://github.com/espressif/esp-idf/tr ... _read/main