-
Notifications
You must be signed in to change notification settings - Fork 7.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ledcFade can lead to dead-lock on ESP32-classic #9212
Comments
@TD-er - based on the fact that you are using the C2 to test it, I guess that this is about Arduino Core 3.0.0-Alpha2. @P-R-O-C-H-Y - Please take a look. It may be related to this change: https://github.com/espressif/arduino-esp32/pull/9031/files |
Yep, the latest code from Arduino and ESP-IDF. |
Hi @TD-er, I am now taking a look at this. Just quick question, why would you call every time the |
I have used you non-working code in testing sketch, but no issues on my side.
Serial output:
Edit: as the pin is not used for anything else, the |
The actual use case is about letting a LED fade from one state to another state and then back again. |
Board
ESP32 (classic)
Device Description
ESP32-classic
Hardware Configuration
Nothing attached to the board
Version
latest master (checkout manually)
IDE Name
PlatformIO
Operating System
Windows 11
Flash frequency
40MHz
PSRAM enabled
yes
Upload speed
115200
Description
Several calls to
ledcAttach
followed byledcFade
on the same pin without callingledcDetach
for that pin will lead to a completely frozen system on ESP32.N.B. the same code on ESP32-C2 does not show this behavior. Not tested on other ESP32-variants.
Since there doesn't seem to be a simple check to see if a pin is already attached, I added a simple
ledcWrite
check first to set the start duty cycle for the upcoming fade.If this returns false, I run
ledcAttach
on that pin.So either of these 2 variants do work:
Sketch
Debug Message
Other Steps to Reproduce
No response
I have checked existing issues, online documentation and the Troubleshooting Guide
The text was updated successfully, but these errors were encountered: