m5stack / M5Stack

M5Stack Arduino Library
MIT License
1.21k stars 429 forks source link

M5paper deep sleep #238

Closed openmotion closed 3 years ago

openmotion commented 3 years ago

hello i have problem with esp_deep_sleep_start when the m5paper is connected with usb in my computer the deep sleep is ok, the deep sleep start and wake but when the m5paper use the internal lipo it don't wake up what is the problem ? thanks

felmue commented 3 years ago

Hello @openmotion

if you look into M5.begin() you'll see enableMainPower(); being called. This is GPIO2 which keeps the MOSFET open. When ESP32 goes into deep sleep by default GPIOs do not keep their state (to save energy) which in this case cuts the power to the ESP32. You'll need to make sure GPIO2 stays powered and keeps its state during deep sleep to avoid power being cut off.

BTW: this issue should be reported in the M5Paper github repository.

Thanks Felix

openmotion commented 3 years ago

hello thanks for your response, how to make sure GPIO2 stays powered ? thanks

felmue commented 3 years ago

Hello @openmotion

on M5CoreInk (which has a similar architecture) below lines work (note: untested on M5Paper):

gpio_hold_en(M5EPD_MAIN_PWR_PIN);
gpio_deep_sleep_hold_en();
esp_deep_sleep_start();

Thanks Felix

openmotion commented 3 years ago

thanks @felmue it works ! gpio_hold_en((gpio_num_t)M5EPD_MAIN_PWR_PIN); gpio_deep_sleep_hold_en(); esp_deep_sleep_start();

felmue commented 3 years ago

Hello @openmotion

glad to hear it worked - thank you for reporting back.

Enjoy your M5Paper!

Cheers Felix

openmotion commented 3 years ago

it worked !