arduino-esp32
arduino-esp32 copied to clipboard
ESP32C3F4H abnormal deep_sleep current leakage (reason : VDD_SPI must NOT be connected to the 3v3 rail)
Board
ESP32-C3 custom board
Device Description
custom board with ESP32C3F4H and ultra lo Iq LDO (500nA).
Hardware Configuration
external chips / peripherals have been remove or disconnected for the test, some pullups are left : 0 ,1 ,2, 8 : 10K 10 : 100K
Version
v2.0.4
IDE Name
arduino IDE
Operating System
windows 10
Flash frequency
80M
PSRAM enabled
no
Upload speed
921600 (not relevant for CDC)
Description
The curent drawn in deep sleep is 2500uA, while it should be 5uA, obviously there is a leak somehwere, i suspect the GPIOs are not going into high impedance when i set them to ANALOG, or something else is wrong. I use the RTC timer deep sleep mode and disable other sources of wakeup. If i use gpio_reset_pin then it cannot enters deep sleep at all. Since everything else is removed from the board i am now sure it comes from the ESP32C3, besides, the quiescent current has been tested valid when the ESP32C3 is removed (under 0.5uA).
Sketch
void gpios_hiz(void){
pinMode(0, ANALOG);
pinMode(1, ANALOG);
pinMode(2, ANALOG);
pinMode(3, ANALOG);
pinMode(4, ANALOG);
pinMode(5, ANALOG);
pinMode(6, ANALOG);
pinMode(7, ANALOG);
pinMode(8, ANALOG);
pinMode(9, ANALOG); is removed
pinMode(10, ANALOG);
pinMode(11, ANALOG);
// pinMode(12, ANALOG);
// pinMode(13, ANALOG);
// pinMode(14, ANALOG);
// pinMode(15, ANALOG);
// pinMode(16, ANALOG);
// pinMode(17, ANALOG);
pinMode(18, ANALOG);
pinMode(19, ANALOG);
pinMode(20, ANALOG);
pinMode(21, ANALOG);
// this does not work and prevents entering deep sleep
// for(int i = 0; i < SOC_GPIO_PIN_COUNT; ++i) {
// if(GPIO_IS_VALID_GPIO(i) && !GPIO_IS_INTERNAL_FLASH_PIN(i)) {
// gpio_reset_pin((gpio_num_t)i);
// }
// }
}
void deep_sleep_enter(void){
esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_ALL);
esp_sleep_config_gpio_isolate();
esp_deep_sleep(15*1000000);
}
void setup(){
Serial.begin(115200);
//while(!Serial)delay(1);
printf("System ready");
delay(8000);
gpios_hiz();
deep_sleep_enter();
}
void loop(){
}
Debug Message
none
Other Steps to Reproduce
none
I have checked existing issues, online documentation and the Troubleshooting Guide
- [X] I confirm I have checked existing issues, online documentation and Troubleshooting guide.
i disconnected 3 pullups and it is now down to 1975uA, this confirms the GPIOs are not really in high impedance state.
nb: no rtc crystal is installed, since GPIO 0 and 1 are used
some pullups are left : 0 ,1 ,2, 8 : 10K 10 : 100K
3.3V / 10K are 0.00033A or 0.33mA 0.33mA * 4 are about 1.32mA so when you are remove ESP32, the internal inpedance or maybe its mode output. I not sure but the current is so similar 🤷♀️
I have one question: arduino IDE can compile single-core ESP32-C3 ??? I know the arduino-esp32 only work with dual-core, any news ?
not sure which "internal impedance" (of what?) you are talking about. Besides, adding the pullup resistors current is not going to give you the total current, it is much more complex than that, some of these pullups are connected to MOS, there is internal pull-up/down and there is various internal peripherals which may be prevented to sleep if configuration is not correct, etc. There is also some relations between gpios outside the chip itself, which can complicate things. Bottom line is, the GPIOs are not in high impedance mode yet, otherwise external pullups would have no influence, which is the problem.
I have one question: arduino IDE can compile single-core ESP32-C3 ??? I know the arduino-esp32 only work with dual-core, any news ?
it is not appropriate to ask a totally unrelated question into someone else issue, you have forums for that, besides, ESP32C3 is a single core, so not sure what you are talking about.
just tested on another design which has most GPIOs floating (connected to a header which is disconnected), only the two pullups for bootstrap, and i get the same result, 3500uA
Hello @0x0fe in my custom design change the pullup resistors from 10K to 100K and the battery life improves. I don't know about your case, but I still have the problem of inappropriate consumption, which is not mentioned in the datasheet. the truth is that I don't know where it comes from
yeah i think you dont have much clue, and thus not much business replying in such technical issue. if your GPIOs are high impedance then the value of external pullups has zero incidence, that is quite basic concept to understand.
If you had to change your external pullups to reduce the current then it means you did not set the GPIOs to high impedance state.
Are you able to get to the power level you are looking for if you use esp_sleep_pd_config to turn off all the power domains?
Are you able to get to the power level you are looking for if you use esp_sleep_pd_config to turn off all the power domains?
i haven't tried to use the sleep pd config to manually turn everything off, good idea let me try this
well, adding these actually increased the current to 3750uA
// disable all RTC features except the timer
esp_sleep_pd_config(ESP_PD_DOMAIN_MAX, ESP_PD_OPTION_OFF);
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_OFF);
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_SLOW_MEM, ESP_PD_OPTION_OFF);
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_FAST_MEM, ESP_PD_OPTION_OFF);
tried this too, with not much success (around 3650uA)
void hibernate(void){
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_OFF);
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_FAST_MEM, ESP_PD_OPTION_OFF);
esp_sleep_pd_config(ESP_PD_DOMAIN_XTAL, ESP_PD_OPTION_OFF);
esp_sleep_pd_config(ESP_PD_DOMAIN_VDDSDIO, ESP_PD_OPTION_OFF);
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC8M, ESP_PD_OPTION_OFF);
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_SLOW_MEM, ESP_PD_OPTION_OFF);
esp_sleep_enable_timer_wakeup(15 * 1000000);
printf("going to sleep. woken up %d\n", timesWokenUp++);
esp_deep_sleep_start();
}
for reference the schematic of the second board used for tests, S1 to S6 are going to a disconnected header, D3_P and D3_N is the USB-C receptacle, the only thing not shown on this schematic is the LDO which is the same as the first board, 500nA quiescent current, verified.
i notice : when the C3 goes out of deep sleep it seems to reset and it does pass the bootloader again, which seems wrong, is that the expected behaviour? anyway the problem is still not solve, with over 3550uA when it should be in deep sleep under 5uA, now tested after the LDO, so the only consumer here is the C3. The debug level is set to verbose and there is absolutely nothing except the bootlaoder traces and the printf i added, which never increments by the way.
Could someone at expressif just test the deep sleep on C3 with last ESP32 core for Arduino? to exclude any external leakage i test with the board mentioned in the previous messe, i tested tens SDK calls, to no avail, I start to be out of options on what to try? @me-no-dev
about VDD SPI, i feed it with the 3V3 rail, should i disconnect it? I use the 4H which has internal flash, so it always seems a little strange to me that we have to feed VDD_SPI when using internal flash, decoupling is expected, but external feeding not so much.
alright, so i went ahead and cut the trace, letting only decoupling, and miracle, the deep sleep current is now 5uA, well, what to say other than the issue system is not very efficient.
This forum is for issues with the arduino-esp32 software housed and developed here. It is not for general hardware issues. Those will receive more attention at esp-idf or esp32.com.
that is true, however, there was no obvious clue that it was hardware related, and i had all reasons to think it was related to ESP32 core instead, until i found the root cause. Besides the platform this project is tied to (by specs) is arduino ESP32 core.
Regardless i think this is quite a major point to highlight in the hardware design reference and datasheet, The datasheet does not provide any warning regarding deep_sleep current leakage if VDD_SPI is connected to the 3V3 rail, and the diagram below can easily lead to think it should or could be connected to the 3V3 rail, being directly powered by it, while In fact it must NOT be connected to the 3V3 rail (unless we want a >1900uA leakage in deepsleep and halt mode).
Not sure why they precise it is an input as well. In the case of 4H version (internal flash) it surely cannot be an input in any case since it powers the flash, thus cannot be in GPIO mode, and leads to massive leakage if connected to the 3V3 rail.
So i let the issue open so that Espressif can hopefully read it and add some warning in the next datasheet/hardware referernce revisions, before they close the issue.
i close the issue, but i think it should be highlighted in the datasheet that VDD_SPI is not an input.