-
Notifications
You must be signed in to change notification settings - Fork 7.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using SCL for deep-sleep wakeup breaks I2C after one sleep cycle (IDFGH-9572) #10921
Comments
UPDATE: While making some changes in an older version of our firmware (built with ESP-IDF v4.4.1), I inadvertently ran into the same issue, but this time with the LEDC component. I was changing it to work on a different board, so I set LEDC to use a GPIO which was previously used for wakeup from deep sleep. LEDC ended up working after a hard reset, but stopped working after device entered deep-sleep and woke back up. The only way to revive it was again to hard reset the chip (pull CHIP_EN low). So as it turns out, this issue isn't exclusive to I2C. I'll do some tests with regular digital GPIOs to see if those are affected as well. Additionally, I tried disabling all wakeup sources as soon as the device woke up from deep sleep, but that didn't have any effect. ...
void app_main(void) {
ESP_ERROR_CHECK(esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_ALL)); // ADDED THIS
ESP_LOGI(TAG, "I'm awake");
i2c_config_t i2c_config = {
.mode = I2C_MODE_MASTER,
.sda_io_num = I2C_SDA,
.scl_io_num = I2C_SCL,
.sda_pullup_en = true,
.scl_pullup_en = true,
.master = {.clk_speed = 100000},
.clk_flags = 0
};
... |
Hi tadejg, We have a fix on master (eae70a8) is supposed to fix the issue. Before the backports are ready, is it possible to try running your app on master branch to see if it's the correct fix for your issue? Thanks, Michael |
@ginkgm thank you, switching to master fixed the issue. Any ETA on when the fix will be backported? |
Answers checklist.
General issue report
We have a product made up of two separate units only connected by a USB cable. USB power pins are used to deliver power to the secondary module and data pins are used as an I2C bus to enable communication between the two. Recently, a need arose to have the secondary module wakeup the ESP32c3 (located on the primary module) from deep sleep. Since our I2C bus is connected to RTC GPIOs 4 (SDA) & 5 (SCL) and we can't add an additional interrupt line between the two modules, we want to use SCL to issue a wakeup interrupt to the ESP.
However, when testing this approach, we ran into an issue with I2C breaking after the first sleep cycle. I have prepared a reproducible example which you can find below. The example expects an I2C device with address
0x0E
and register0x0F
set to0x35
. After flashing the firmware it's able to successfully read the register and enter deep-sleep. After it wakes up, the I2C command times out, causing an abort. Device gets stuck in this cycle until a hard reset is issued. If you comment out the line which configures SCL pin for wakeup, firmware works as expected - reads register, enters sleep, wakes up, and continues without error.We're using ESP32c3 with ESP-IDF v5.0.1
Output before entering deep sleep:
Output after waking up from deep-sleep:
As a workaround, I tried replacing
abort()
withesp_restart()
, but that didn't change anything. It appears the only solution is to pull CHIP_EN low.The text was updated successfully, but these errors were encountered: