Skip to content

Commit

Permalink
Merge branch 'fix/ths_enbale_charge_ic' into 'master'
Browse files Browse the repository at this point in the history
fix(ulp_example): enable the LDO chip at power-up

See merge request ae_group/esp-iot-solution!1000
  • Loading branch information
leeebo committed May 22, 2024
2 parents 8481471 + 35ac021 commit d7b0715
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 18 deletions.
37 changes: 19 additions & 18 deletions examples/ulp/lp_cpu/lp_environment_sensor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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.
...
Expand All @@ -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.
...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit d7b0715

Please sign in to comment.