Error using ledc_set_freq() function

khoi.ly
Posts: 1
Joined: Tue Aug 14, 2018 3:57 pm

Error using ledc_set_freq() function

Postby khoi.ly » Tue Aug 14, 2018 4:10 pm

Hi all,

I was trying to combine two ESP-IDF examples: one is ADC that I use an external potentiometer to adjust the ADC reading, and the other is to update the blinking LED PWM frequency.

Hardware setup:
Pot: 3.3V, GND, and pin GPIO34
GPIO 18 -> LED -> 330 Ohm resistor -> GND

Here is my code:
ADC_PWM.c
Using Pot to control PWM frequency of LED
(4.33 KiB) Downloaded 43 times
When I turn the pot knob down such that the mapped frequency is less than 10Hz, I get "ledc: div param err, div_param=2500000." When I increase the ADC reading voltage such that the mapped frequency is above 10 Hz, the problem is gone.
What does this error mean? And how do it fix it?

I tried with giving a fixed ledc_timer.freq_hz to the ledc_set_freq() function, but the problem remains the same.
I also tried turning of vTaskDelay(), the problem remains the same.

Thank you for any suggestions and comments

Who is online

Users browsing this forum: Dzhest, Google [Bot] and 17 guests