Page 1 of 1

Making DMA/I2S output to LEDC PWM?

Posted: Thu Dec 16, 2021 7:14 pm
by aj22rr
Hi. I know that I2S can connect directly to the DAC and output data through DMA but is it possible to have it output data to the PWM controller (duty cycle)?
Also, I've noticed that when I change the LEDC PWM frequency the signal on the output pin is constantly high/low for, I'm guessing, one PWM cycle or as long as it takes to reset the LEDC PWM controller. It would be great if i could change the PWM modulation frequency every single cycle (20-30kHz).

Re: Making DMA/I2S output to LEDC PWM?

Posted: Tue May 03, 2022 9:36 am
by ankostis
I was thinking the same, and i would try to use interrupts, to modify the duty-cycle at the end of each cyce.
In principle, you don't need to modify the PWM frequency to replicate ADC signal, you should achieve similar effects by modifying just the duty-cycle (PWM controllers have custom logic for fast control).

I would take inspiration from the way ESP_IDF ledc-driver has achieved fade-in/out effects synced with the duty cycle (if my understanding is correct).
Please keep this post updated if you have any success with it.