-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
internal pulldown during deep sleep on esp32c6 broken since version 3.1.0 (works fine on 3.0.7) #10907
Comments
Can you try adding |
no, that didn't help. I also tried adding gpio_reset_pin() before I configured, and that didn't help. |
@illusionmanager I have tested the deep sleep example we have in the core, edited to use EXT1 and GPIO 7. For me it's working fine on Espressifs ESP32-C6 DevKit-M. Wakes up only when I connect GPIO 7 to 3v3 pin. EDIT: You wanted to use the pullUP not pullDOWN. I will check again |
@illusionmanager Working fine for me with the devkit I have. #include "driver/rtc_io.h"
#define BUTTON_PIN_BITMASK(GPIO) (1ULL << GPIO) // 2 ^ GPIO_NUMBER in hex
#define WAKEUP_GPIO GPIO_NUM_7
RTC_DATA_ATTR int bootCount = 0;
void print_wakeup_reason() {
esp_sleep_wakeup_cause_t wakeup_reason;
wakeup_reason = esp_sleep_get_wakeup_cause();
switch (wakeup_reason) {
case ESP_SLEEP_WAKEUP_EXT0: Serial.println("Wakeup caused by external signal using RTC_IO"); break;
case ESP_SLEEP_WAKEUP_EXT1: Serial.println("Wakeup caused by external signal using RTC_CNTL"); break;
case ESP_SLEEP_WAKEUP_TIMER: Serial.println("Wakeup caused by timer"); break;
case ESP_SLEEP_WAKEUP_TOUCHPAD: Serial.println("Wakeup caused by touchpad"); break;
case ESP_SLEEP_WAKEUP_ULP: Serial.println("Wakeup caused by ULP program"); break;
default: Serial.printf("Wakeup was not caused by deep sleep: %d\n", wakeup_reason); break;
}
}
void setup() {
Serial.begin(115200);
delay(1000); //Take some time to open up the Serial Monitor
//Increment boot number and print it every reboot
++bootCount;
Serial.println("Boot number: " + String(bootCount));
//Print the wakeup reason for ESP32
print_wakeup_reason();
//If you were to use ext1, you would use it like
esp_sleep_enable_ext1_wakeup_io(BUTTON_PIN_BITMASK(WAKEUP_GPIO), ESP_EXT1_WAKEUP_ANY_LOW);
rtc_gpio_pullup_en(WAKEUP_GPIO);
rtc_gpio_pulldown_dis(WAKEUP_GPIO);
//Go to sleep now
Serial.println("Going to sleep now");
esp_deep_sleep_start();
Serial.println("This will never be printed");
}
void loop() {
//This is not going to be called
} |
are you using 3.1.1? This works works fine on 3.0.7 but not on 3.1.1. |
I tested on master. |
Can you set debug level to verbose and post a complete log? Thanks |
i never used the debugger, if you can quickly tell me who to create this
log for you, I'm glad to assist.
…On Mon, Jan 27, 2025 at 3:19 PM Jan Procházka ***@***.***> wrote:
Can you set debug level to verbose and post a complete log? Thanks
—
Reply to this email directly, view it on GitHub
<#10907 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AS7S2IMHC6SABE6FA3JP3OL2MY6A3AVCNFSM6AAAAABV43JCGSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMMJVHA4DQNRTGY>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Just in the Arduino IDE go to Tools menu and set "Debug level" -> Verbose. Then flash/upload again the sketch to the esp32c6 as usual. In the Serial monitor you will see a huge log with all informations. So please send that (log after reboot to before going to sleep) |
I ran it twice. first output is from arduino version 3.1.1, it automatically wakes up (it shouldn't, because for testing nothing is connected to GPIO_7 so there is more output and goes on to boot number 2 (and 3 and 4 but I didn't add a copy of that into this log) 16:47:22.387 -> Chip Info: ############################################################################################################################### same program now with version 3.0.7. Note that this is all the output as I didn't wake it up manually. (which works fine on 3.0.7) 17:00:37.743 -> =========== Before Setup Start =========== |
Comparing your log with mine I have everything the same (chip revision, idf version). I have no clue what's wrong there, as it works for me fine with the example I provided on my C6 board. There was no change to this part of the Arduino core between 3.0.X and 3.1.X. |
Well, by now I have repeatedly going between 3.1.1 (and once 3.1.0) and
3.0.7 and the behaviour is consistent. Something definitely did change
between those versions. I also tried another esp32c6 board and it shows
exactly the same behavior. Is very repeatable on my end. Of course I'm
happy that finally I discovered it works fine on 3.0.7, but it would be bad
if in all versions after that it would stop working.
…On Tue, 28 Jan 2025, 09:33 Jan Procházka, ***@***.***> wrote:
Comparing your log with mine I have everything the same (chip revision,
idf version). I have no clue what's wrong there, as it works for me fine
with the example I provided on my C6 board. There was no change to this
part of the Arduino core between 3.0.X and 3.1.X.
—
Reply to this email directly, view it on GitHub
<#10907 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AS7S2IPD6K6GHUI6YQB6MIL2M46F5AVCNFSM6AAAAABV43JCGSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMMJYGI2TSMJQHE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I am trying to make it not work, but in every scenario it works for me. Can you try this code? #include "driver/rtc_io.h"
#define BUTTON_PIN_BITMASK(GPIO) (1ULL << GPIO) // 2 ^ GPIO_NUMBER in hex
#define WAKEUP_GPIO GPIO_NUM_7 // Only RTC IO are allowed - ESP32 Pin example
RTC_DATA_ATTR int bootCount = 0;
void print_wakeup_reason() {
esp_sleep_wakeup_cause_t wakeup_reason;
wakeup_reason = esp_sleep_get_wakeup_cause();
switch (wakeup_reason) {
case ESP_SLEEP_WAKEUP_EXT0: Serial.println("Wakeup caused by external signal using RTC_IO"); break;
case ESP_SLEEP_WAKEUP_EXT1: Serial.println("Wakeup caused by external signal using RTC_CNTL"); break;
case ESP_SLEEP_WAKEUP_TIMER: Serial.println("Wakeup caused by timer"); break;
case ESP_SLEEP_WAKEUP_TOUCHPAD: Serial.println("Wakeup caused by touchpad"); break;
case ESP_SLEEP_WAKEUP_ULP: Serial.println("Wakeup caused by ULP program"); break;
default: Serial.printf("Wakeup was not caused by deep sleep: %d\n", wakeup_reason); break;
}
}
void setup() {
Serial.begin(115200);
delay(1000); //Take some time to open up the Serial Monitor
//Increment boot number and print it every reboot
++bootCount;
Serial.println("Boot number: " + String(bootCount));
//Print the wakeup reason for ESP32
print_wakeup_reason();
//rtc_gpio_init(WAKEUP_GPIO);
//rtc_gpio_set_direction(WAKEUP_GPIO, RTC_GPIO_MODE_INPUT_OUTPUT);
//rtc_gpio_set_level(WAKEUP_GPIO, 1);
//If you were to use ext1, you would use it like
esp_sleep_enable_ext1_wakeup_io(BUTTON_PIN_BITMASK(WAKEUP_GPIO), ESP_EXT1_WAKEUP_ANY_LOW);
rtc_gpio_pulldown_dis(WAKEUP_GPIO);
rtc_gpio_pullup_en(WAKEUP_GPIO);
//Go to sleep now
Serial.println("Going to sleep now");
esp_deep_sleep_start();
Serial.println("This will never be printed");
}
void loop() {
//This is not going to be called
} |
I will in a moment. Just to make sure it is not the problem that it won't
wake up, it will, it will however do so automatically in 3.1.0 and above.
…On Tue, 28 Jan 2025, 09:55 Jan Procházka, ***@***.***> wrote:
I am trying to make it not work, but in every scenario it works for me.
Can you try this code?
I have switched the order of pullup/pulldown. Give it a try and if that I
still not working for you, can you try to uncomment the section above the
esp_sleep_enable_ext1_wakeup_io and try again. Please do both tests.
Thanks
#include "driver/rtc_io.h"
#define BUTTON_PIN_BITMASK(GPIO) (1ULL << GPIO) // 2 ^ GPIO_NUMBER in hex
#define WAKEUP_GPIO GPIO_NUM_7 // Only RTC IO are allowed - ESP32 Pin example
RTC_DATA_ATTR int bootCount = 0;
void print_wakeup_reason() {
esp_sleep_wakeup_cause_t wakeup_reason;
wakeup_reason = esp_sleep_get_wakeup_cause();
switch (wakeup_reason) {
case ESP_SLEEP_WAKEUP_EXT0: Serial.println("Wakeup caused by external signal using RTC_IO"); break;
case ESP_SLEEP_WAKEUP_EXT1: Serial.println("Wakeup caused by external signal using RTC_CNTL"); break;
case ESP_SLEEP_WAKEUP_TIMER: Serial.println("Wakeup caused by timer"); break;
case ESP_SLEEP_WAKEUP_TOUCHPAD: Serial.println("Wakeup caused by touchpad"); break;
case ESP_SLEEP_WAKEUP_ULP: Serial.println("Wakeup caused by ULP program"); break;
default: Serial.printf("Wakeup was not caused by deep sleep: %d\n", wakeup_reason); break;
}
}
void setup() {
Serial.begin(115200);
delay(1000); //Take some time to open up the Serial Monitor
//Increment boot number and print it every reboot
++bootCount;
Serial.println("Boot number: " + String(bootCount));
//Print the wakeup reason for ESP32
print_wakeup_reason();
//rtc_gpio_init(WAKEUP_GPIO);
//rtc_gpio_set_direction(WAKEUP_GPIO, RTC_GPIO_MODE_INPUT_OUTPUT);
//rtc_gpio_set_level(WAKEUP_GPIO, 1);
//If you were to use ext1, you would use it like
esp_sleep_enable_ext1_wakeup_io(BUTTON_PIN_BITMASK(WAKEUP_GPIO), ESP_EXT1_WAKEUP_ANY_LOW);
rtc_gpio_pulldown_dis(WAKEUP_GPIO);
rtc_gpio_pullup_en(WAKEUP_GPIO);
//Go to sleep now
Serial.println("Going to sleep now");
esp_deep_sleep_start();
Serial.println("This will never be printed");
}
void loop() {
//This is not going to be called
}
—
Reply to this email directly, view it on GitHub
<#10907 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AS7S2IOJXTH2YBUI3TWAX4L2M5AYLAVCNFSM6AAAAABV43JCGSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMMJYGMZTEMRQGI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
bingo, your downloaded version as is didn't work, but with uncommenting the part above it it works fine. No more automatic wakeups and the manual wake up works. Great. |
Thank you for quick tests. I am closing this issue as solved. |
could you explain to me why the new code works? |
it turns out the only two lines needed were rtc_gpio_init(WAKEUP_GPIO); so no need to drive the output high. |
Thanks for the additional feedback and test. I am glad that using |
was it? you first defined the pin to both input and output and then you set the output level to 1. Doesn't that drive it high? connecting it directly to gnd for a wakeup, might cause a big current, a too big current perhaps. |
Board
esp32c6
Device Description
its the xiao seeed studio esp32c6 board
Hardware Configuration
nothing connected but want to use GPIO_7 (same problem with GPIO_5)
Version
latest master (checkout manually)
IDE Name
arduino ide
Operating System
windows 10
Flash frequency
?
PSRAM enabled
yes
Upload speed
115200
Description
I wanted to use the internal pull down on GPIO_7 during deep sleep and wake up when it becomes high. It doesn't work and wakes up automatically (probably from the 50hz mains noise) I tried lots of different options, none worked. Strangely enough it worked for someone else in the forum. After a long time it was discovered that it works fine in version 3.0.7 while I was using version 3.1.1. I switch to 3.0.7 and it works. I switched to 3.1.0 and it fails. switched back to 3.0.7 and it works.
Sketch
Debug Message
Other Steps to Reproduce
No response
I have checked existing issues, online documentation and the Troubleshooting Guide
The text was updated successfully, but these errors were encountered: