I'm using I2C and deep sleep in my application. And I want to wakeup ESP32 by low level on SDA line.
After hard reset I can receive data in I2C slave mode without any problems.
The same code fails after configuring SDA for deep sleep, entering deep sleep and waking up.
I2C setup code:
Code: Select all
i2c_config_t cfg;
memset(&cfg, 0x00, sizeof(cfg));
cfg.mode = I2C_MODE_SLAVE;
cfg.sda_io_num = SU_HARDWARE_I2CSDA;
cfg.sda_pullup_en = GPIO_PULLUP_ENABLE;
cfg.scl_io_num = SU_HARDWARE_I2CSCL;
cfg.scl_pullup_en = GPIO_PULLUP_ENABLE;
cfg.slave.slave_addr = SU_HARDWARE_I2CADDR;
if(SU_WRAP(i2c_param_config(SU_HARDWARE_I2CPORT, &cfg)) != ESP_OK)
goto JmpCleanup0;
if(SU_WRAP(i2c_driver_install(SU_HARDWARE_I2CPORT, cfg.mode, gSuBufferSize, gSuBufferSize, 0)) != ESP_OK)
goto JmpCleanup1;
Code: Select all
SU_WRAP(esp_sleep_enable_timer_wakeup(gSuSleepTimeout * 1000));
SU_WRAP(esp_sleep_enable_ext0_wakeup(SU_HARDWARE_I2CSDA, 0));
esp_deep_sleep_start();
Code: Select all
if(i2c_slave_read_buffer(SU_HARDWARE_I2CPORT, op, 1, gSuTimeout) != 1)
{
SU_WRAP(ESP_FAIL);
return false;
}
Any idea?
Thank you
Stefan