LEDC unable to attain 100% duty at 120Hz; no pulse at 60Hz?
Posted: Mon Aug 27, 2018 12:57 am
I have generated a LEDC PWM output at 120Hz and faded between 0 and 1 * (1 << LEDC_TIMER_19_BIT). During the fade period a separate task polled ledc_get_duty() and reported values that basically made sense. However on the oscilliscope it seemed the pulse grew from zero to around 2/3rds, instead of all the way to a full wavelength. I reduced the configured frequency to 60Hz and observed no signal was generated at all (also evidenced by ledc_get_duty() returning 0). I set it back to 120Hz and observed a signal again. Then I tried reducing the resolution, from 19 bits to 13 bits, and observed a pulse. I reduced it further to 8 bits and observed no pulse (@ 120Hz). It seemed odd I could not detect a pulse at 120Hz/8 bits resolution, or 60Hz/19 bits resolution. I did attempt to configure an unrealistically high test frequency of 1200000000Hz in order to observe that ledc_* api was in fact generating an error, and it did so in accordance with documentation. Anyhow, I am trying to understand why I might not be able to observe a 100% duty pulse at 120Hz, or why I can't seem to generate any pulse at 60Hz?