From 65eafd16b5328a42a8ec6bcaa8aaf26f0ad9729f Mon Sep 17 00:00:00 2001 From: Rodrigo Garcia Date: Mon, 26 Jul 2021 14:37:44 -0300 Subject: [PATCH] Fixes ESP32-S2 LEDC PWM #5375 #5050 (#5452) Fixes: #5375 Fixes: #5050 --- cores/esp32/esp32-hal-ledc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cores/esp32/esp32-hal-ledc.c b/cores/esp32/esp32-hal-ledc.c index 5881b400..102e5bbb 100644 --- a/cores/esp32/esp32-hal-ledc.c +++ b/cores/esp32/esp32-hal-ledc.c @@ -115,6 +115,10 @@ static void _ledcSetupTimer(uint8_t chan, uint32_t div_num, uint8_t bit_num, boo uint8_t group=(chan/8), timer=((chan/2)%4); static bool tHasStarted = false; static uint16_t _activeChannels = 0; +#if CONFIG_IDF_TARGET_ESP32S2 +// ESP32-S2 TRM v1.0 on Page 789 -> BIT LEDC_TICK_SEL_TIMERx is 0 for LEDC_PWM_CLK and 1 for REF_TICK + apb_clk = 0; +#endif if(!tHasStarted) { tHasStarted = true; periph_module_enable(PERIPH_LEDC_MODULE);