Description
Board
ESP32
Device Description
ESP32
Hardware Configuration
transducer and backlight
Version
latest development Release Candidate (RC-X)
IDE Name
Arduino IDE
Operating System
Windows 10
Flash frequency
40Mhz
PSRAM enabled
no
Upload speed
115200
Description
The new function got rid of the setup call that allowed you to manually set your channel. The problem is my project has a audio transducer and a lcd with backlight. When using ledc for tones and controlling the backlight brightness the two interfere. This is because the esp groups two sets of eight channels and the frequency is shared amongst the set. Since it now auto adds the channels its grouping both of my devices and when the frequency changes for tone control the backlight is then off and you can't fix this without a blinking in the backlight while they are grouped. Previously I could set channel 1 for backlight and 9 for the speaker and everything was happy since the frequencies were seperated.
Sketch
ledcAttach(buzzer,2000,8);
ledcAttach(TFT_BACKLIGHT,2000,8);
Debug Message
No debug messages
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.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Activity
spyder0069 commentedon Dec 7, 2023
I did find my work around. I found some others talking about how each two consecutive channels share a timer. I thought the first 8 shared one and the second 8 shared another but I was wrong. 4 timers spread out. It was mentioned here "github.com/esphome/issues/issues/3114"
My workaround was to take a unused pin and use it as a unused ledc channel.
myledcresponse=ledcAttach(buzzer,2000,8); myledcresponse=ledcAttach(39,2000,8); // create a false channel with unused input. myledcresponse=ledcAttach(TFT_BACKLIGHT,2000,8);
It would be nice if the option to manually select the channel would be returned to this function in the future.
P-R-O-C-H-Y commentedon Dec 7, 2023
Hi @spyder0069, I will take a look on this. Seems reasonable to have the option to specify the channel.
me-no-dev commentedon Dec 7, 2023
@P-R-O-C-H-Y since this change was caused be the new IDF API, make sure that you read it's code to see how timers are allocated for channels. Timer spreading was something we added before. Made most sense at the time.