-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Closed
Labels
Area: Peripherals APIRelates to peripheral's APIs.Relates to peripheral's APIs.
Description
Board
Custom ESP32-S3 board
Device Description
Custom Gauge.S board
Hardware Configuration
[ 123][I][esp32-hal-ledc.c:166] ledcAttachChannel(): LEDC attached to pin 10 (channel 0, resolution 8)
[ 1791][I][esp32-hal-ledc.c:166] ledcAttachChannel(): LEDC attached to pin 3 (channel 1, resolution 14)
Version
v3.2.0
IDE Name
PlatformIO
Operating System
W11
Flash frequency
80mhz
PSRAM enabled
yes
Upload speed
Default
Description
When setting different resolutions on different channels, second one called disrupts duty resolution calculation and frequency.
Basically I set first one to pin 10 to control backlight LED at 500hz frequency and 8 bit resolution.
Then I use 400Hz PWM output on 14 bit resolution.
After second one is setup the first one goes from very well working to 29 Hz at ~1% duty cycle (measured with scope).
Sketch
not relevant
Debug Message
Got scope trace but its not very interesting.
Other Steps to Reproduce
No response
I have checked existing issues, online documentation and the Troubleshooting Guide
- I confirm I have checked existing issues, online documentation and Troubleshooting guide.To pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel.
Metadata
Metadata
Assignees
Labels
Area: Peripherals APIRelates to peripheral's APIs.Relates to peripheral's APIs.
Activity
P-R-O-C-H-Y commentedon May 19, 2025
Hi @handmade0octopus, Thank you for reporting that. I will try to reproduce and will keep you updated about next steps.
P-R-O-C-H-Y commentedon May 29, 2025
Hi @handmade0octopus, I have tested this issue today and I was able to reproduce. How ever, the solution for you will be to specify the channels to use to avoid this.
The thing is that ESP32S3 have 8 LEDC channels and 4 LEDC Timers. So each 2 channels are sharing 1 timer:
Channel 0 and 1 -> TIMER 0
Channel 2 and 3 -> TIMER 1
Channel 4 and 5 -> TIMER 2
Channel 6 and 7 -> TIMER 3
So you cannot set different timer resolutions for the same timer, as in your case you was probably using auto channel picking so it was 0 and 1. I was able to reproduce your behavior with those channels. Please do this instead:
I will add some check if the timer is used with different resolution to log an Error message to avoid this in future.
PLease test and let me know if that solves the issue. I have tested and it works fine when using another group of channels that uses different timers.