Page 1 of 1

ledc doesn't work after restart or deep sleep wakeup

Posted: Thu Feb 27, 2020 2:52 am
by Auxal3000
Hello
I'm using a ESP32 CAM that has a Led-flash included. I initialize the led in the program and it works ok. But if I call ESP.restart() or after a sleep wake up and the ledc is always of.
I don't know what to do.
Thanks for any help

Re: ledc doesn't work after restart or deep sleep wakeup

Posted: Thu Feb 27, 2020 10:51 am
by Auxal3000
I forgot to send the code:

Before setup:

Code: Select all

#define ledFlash           4 
into setup():

Code: Select all

    ledcSetup(LEDC_CHANNEL_7, 12000, 9); 
    ledcAttachPin(ledFlash, LEDC_CHANNEL_7);
    ledcWrite(LEDC_CHANNEL_7, 0);
into loop():

Code: Select all

 ledcWrite(LEDC_CHANNEL_7, 50);

Re: ledc doesn't work after restart or deep sleep wakeup

Posted: Tue Mar 03, 2020 11:07 pm
by Auxal3000
Solution found

I have seen that before to enter to sleep mode I used the instruction:

Code: Select all

rtc_gpio_hold_en(GPIO_NUM_4);
This block this GPIO to prevent any changes in this pin.
After restart, the chip must execute the instruction:

Code: Select all

rtc_gpio_hold_dis(GPIO_NUM_4);
to unblock it.