I've been working with the ESP32-S3 and I noticed that when using the LEDC peripheral to generate a 100% duty cycle PWM signal (always on), if I use the maximum duty cycle value of (2^resolution - 1) as specified in the documentation (e.g 1023 for 10-bit resolution or 3 for 2-bit resolution), the result is not on all the time.
Instead, it looks as though it goes low for one cycle (period / 2^resolution) at the end of the period. I can reproduce this at all duty cycle resolution widths, but it's really obvious with a 2-bit timer since going low for one cycle results in 75% duty cycle.
I'm able to reproduce this on the ledc_basic example from the latest master on an ESP32-S3-DevKitC-1, modifying only LEDC_DUTY and LEDC_DUTY_RES (and setting the target to esp32-s3, of course), so I don't believe this is specific to my hardware or version of ESP-IDF.
If I set the duty cycle to 2^resolution (e.g 1024 for a 10-bit resolution or 4 for a 2-bit resolution), I do get a fully on 100% duty cycle, though I'm not sure if that's by accident or if that is the intended behavior. Am I misreading the documentation and I should be using 2^resolution for 100% duty cycle, or is this a hardware / software bug in the ESP32-S3 and it should be 2^resolution - 1?
100% duty cycle with ledc on ESP32-S3
100% duty cycle with ledc on ESP32-S3
- Attachments
-
- 10-bit resolution, duty cycle value of 1023
- Screenshot 2023-04-04 at 11.51.26 AM.png (807.82 KiB) Viewed 1449 times
-
- 2-bit resolution, duty cycle value of 3
- Screenshot 2023-04-04 at 11.22.34 AM.png (804.13 KiB) Viewed 1449 times
Who is online
Users browsing this forum: MicroController and 129 guests