From 35ac021b9be70629627b9e4b0fea789f7b04e271 Mon Sep 17 00:00:00 2001 From: Li Junru Date: Tue, 21 May 2024 16:17:41 +0800 Subject: [PATCH] fix(ulp_example): enable the LDO chip at power-up --- .../lp_cpu/lp_environment_sensor/README.md | 37 ++++++++++--------- .../main/lp_environment_sensor.c | 10 +++++ 2 files changed, 29 insertions(+), 18 deletions(-) diff --git a/examples/ulp/lp_cpu/lp_environment_sensor/README.md b/examples/ulp/lp_cpu/lp_environment_sensor/README.md index 95e5fdeb0..267415fe1 100644 --- a/examples/ulp/lp_cpu/lp_environment_sensor/README.md +++ b/examples/ulp/lp_cpu/lp_environment_sensor/README.md @@ -20,16 +20,17 @@ The example hardware has been open-sourced on [OSHW-Hub](https://oshwhub.com/esp - Hardware Connection: -| ESP32-C6 | AHT21B | 2.9-inch e-paper display | -| :------: | :----: | :-----------------------: | -| GPIO6 | SDA | | -| GPIO7 | SCL | | -| GPIO15 | | SCL | -| GPIO18 | | SDA | -| GPIO19 | | RES | -| GPIO20 | | DC | -| GPIO21 | | CS | -| GPIO22 | | BUSY | +| ESP32-C6 | AHT21B | 2.9-inch e-paper display | LDO CHIP | +| :------: | :----: | :----------------------: | :------: | +| GPIO2 | | | EN | +| GPIO6 | SDA | | | +| GPIO7 | SCL | | | +| GPIO15 | | SCL | | +| GPIO18 | | SDA | | +| GPIO19 | | RES | | +| GPIO20 | | DC | | +| GPIO21 | | CS | | +| GPIO22 | | BUSY | | ### Configure the project @@ -64,10 +65,10 @@ By default, this example configured to disable Rainmaker data reporting, HTTP we ``` I (139) main_task: Started on CPU0 I (142) main_task: Calling app_main() -I (147) gpio: GPIO[8]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 -I (156) gpio: GPIO[19]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 -I (165) gpio: GPIO[20]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 -I (174) gpio: GPIO[22]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:2 +I (147) gpio: GPIO[8]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 +I (156) gpio: GPIO[19]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 +I (165) gpio: GPIO[20]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 +I (174) gpio: GPIO[22]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:2 I (3035) LP_Environment_Sensor: e-paper refresh done. I (3036) LP_Environment_Sensor: Enter deep sleep. ... @@ -76,10 +77,10 @@ I (139) main_task: Started on CPU0 I (142) main_task: Calling app_main() wake up by LP CPU. I (148) LP_Environment_Sensor: temperature: 25.918961, humidity: 40.086460 -I (156) gpio: GPIO[8]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 -I (166) gpio: GPIO[19]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 -I (174) gpio: GPIO[20]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 -I (184) gpio: GPIO[22]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:2 +I (156) gpio: GPIO[8]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 +I (166) gpio: GPIO[19]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 +I (174) gpio: GPIO[20]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 +I (184) gpio: GPIO[22]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:2 I (3044) LP_Environment_Sensor: e-paper refresh done. I (3045) LP_Environment_Sensor: Enter deep sleep. ... diff --git a/examples/ulp/lp_cpu/lp_environment_sensor/main/lp_environment_sensor.c b/examples/ulp/lp_cpu/lp_environment_sensor/main/lp_environment_sensor.c index 1fad46874..8812ab56e 100644 --- a/examples/ulp/lp_cpu/lp_environment_sensor/main/lp_environment_sensor.c +++ b/examples/ulp/lp_cpu/lp_environment_sensor/main/lp_environment_sensor.c @@ -48,6 +48,7 @@ extern const uint8_t lp_core_main_bin_start[] asm("_binary_lp_core_main_bin_star extern const uint8_t lp_core_main_bin_end[] asm("_binary_lp_core_main_bin_end"); /* E-paper power control pin, set to 1 to power off the screen, set to 0 to power on the screen. */ +#define LDO_CHIP_EN GPIO_NUM_2 #define EPAPER_PWR_CTRL GPIO_NUM_8 #define EPAPER_BUS_HOST SPI2_HOST #define EPAPER_REFRESH_BIT BIT(0) @@ -289,6 +290,15 @@ static void epaper_task(void *pvParameters) void app_main(void) { + /*!< Config charge IC enable IO */ + gpio_config_t io_conf = { + .pin_bit_mask = (1ULL << LDO_CHIP_EN), + .mode = GPIO_MODE_OUTPUT, + }; + gpio_config(&io_conf); + gpio_set_level(LDO_CHIP_EN, 1); + gpio_hold_en(LDO_CHIP_EN); + /* To refresh the e-paper screen, it takes at least 1250ms. */ esp_ths_event_group = xEventGroupCreate(); if (esp_ths_event_group == NULL) {