vdeschwb / esp32-signal-generator

Open-Source Signal Generator using the ESP32 uC
MIT License
124 stars 32 forks source link

Square wave does not work #13

Open meltdown03 opened 2 years ago

meltdown03 commented 2 years ago

Any time I try to send a Square wave, I get this error on my ESP32-WROVER-B (D0WD - rev 3):

assert failed: ledc_clk_cfg_to_global_clk ledc.c:446 (false)

I tried all different combinations of High/Low Speed, Timer, Channels, Pins. I read something about newer chips may need to use the APB Clock (but only in LOW_SPEED mode it look like) in the comments of the ledc.c file from the ESP-IDF repository.

HermenB commented 1 year ago

Apparently, the timer_config-struct now contains a member clk_cfg. I solved this error by adding the following line to the timer_config-struct in PWM_Module.cpp:

timer_config.clk_cfg = LEDC_AUTO_CLK; // Copied from example esp-idf, "ledc_basic_example_main.c"

Together with the solution described in " Bug in Sine Wave Channel Selection #11 " by tirandagan, SigGen now works as intended.