Closed
Description
Board
ESP32 Dev Module
Device Description
Dev board and LED
Hardware Configuration
GPIO connected to LED
Version
v2.0.4
IDE Name
Arduino IDE
Operating System
Linux
Flash frequency
Whatever
PSRAM enabled
no
Upload speed
115200
Description
The pull request #6045 introduced two regressions:
- It is not possible any more to do the following any more:
ledcSetup(...); ledcAttachPin(...); ledcWrite(...); // set up channel with freqency an duty cycle to blink LED
ledcDetachPin(...) // remove pin (LED OFF)
ledcAttachPin(...) // attach pin again and it continues with SAME frequency and duty as before
as ledcAttachPin nowadays resets the duty cycle of a prefectly working channel setup.
- ledcSetup(channel, 1, 8) can nor set up frequency of 1Hz any more
Harald.
Sketch
I think you understand anyway, see above.
Debug Message
00:49:16.724 -> E (247241) ledc: requested frequency and duty resolution can not be achieved, try reducing freq_hz or duty_resolution. div_param=8460032
00:49:16.758 -> [247245][E][esp32-hal-ledc.c:75] ledcSetup(): ledc setup failed!
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
Type
Projects
Status
Done
Activity
habazut commentedon Sep 28, 2022
Suggestion how to fix ledcAttach:
Regards,
Harald.
VojtechBartoska commentedon Sep 29, 2022
Hello @habazut, our Developer responsible for LedC is on vacation. He will take a look on this at mid of October. Thanks for understanding.
habazut commentedon Sep 29, 2022
I have a workaround for the ledcAttach() issue (call ledc_set_pin direct) but not for the frequency issue of ledcSetup() for 1Hz. So if anyone has an idea how to get a LED to blink with PWM 1Hz, I would be grateful if you let me know.
Regards,
Harald.
P-R-O-C-H-Y commentedon Oct 12, 2022
Hello @habazut ,
Simple rule for using LEDC
lower frequencies -> higher resolution
higher frequencies -> lower resolution (example 40MHz freq can be set only with bit resolution 1)
I was able to set 1Hz frequency using 12 bits resolution
ledcSetup(0,1,12);
6 remaining items