ESP32-C3 random reboot when light sleep, powersaving ON(fixed!) and not keep IO pin HIGH(fixed too).
Maintainer antworten meist innerhalb von 2 Tagen
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 48/100
- Issue-Typ
- Bug
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- c
- Bereich
- embedded-iot
Rechercherichtung
Read the ESP32-C3 sleep path in ESP32Board.h and compare it with the reported changes: preserving GPIO state during sleep and adding a 500 µs delay before esp_light_sleep_start(). Reproduce the reported receiver pin drop and random reboot with powersaving enabled, then verify the fixes across sleep and wake cycles. The issue also mentions Serial CLI handling in simple repeater/main.cpp, but does not establish that as a confirmed cause.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Hello,
Two issue I fix, I use ESP32-C3 supermini board with a E22-900 30 dbm module. RXEN is wired to GPIO10, this pin are not on the RTC domain.
When my board go to sleep (powersaving ON) receiver become deaf. I found the RXEN(GPIO10) pin, become floating or dropping to LOW and receiver preamp is disabled. I add this line to my own variant ::begin() to to force CPU to keep all IO at it current state when sleeping:
esp_sleep_enable_gpio_switch(false); // VE2YAG: Needed or C3 return pin le LOW or float during sleep (RX enable disabled)
This fix the issue, ESP32-C3 now keep it IO at current level during sleep, insteed of become floating.
Second issue:
When my ESP32-C3 meshcore is running and light sleep (powersaving ON), it randomly reboot with rst: 0x1 code (cold boot) After many hour of testing and debugging, the CPU reboot during it's sleeping time, just reboot when sleeping. I beefer power, put big capacitor on 3.3v and 5v rail, nothing prevent rebooting.
Finally, it seem to be a C3 bug when enter sleeping, you need to insert a small delay before entering sleep. I add this line: (ESP32Board.h)
// Configure GPIO wakeup
esp_sleep_enable_gpio_wakeup();
gpio_wakeup_enable((gpio_num_t)wakeupPin, GPIO_INTR_HIGH_LEVEL); // Wake up when receiving a LoRa packet
// MCU enters light sleep
delayMicroseconds(500);
esp_light_sleep_start();
// Avoid ISR flood during wakeup due to HIGH LEVEL interrupt
gpio_wakeup_disable(wakeupPin);
gpio_set_intr_type(wakeupPin, GPIO_INTR_POSEDGE);
500uS delay seem to be enough to fix my ramdom reboot.Also I reduce sleeping time to 1 second to worst the problem, and all is fine, random reboot is gone.
Note:
I have a reboot once, sending to console "unknown command" and reboot. I disable Serial CLI handling when CPU use sleeping, maybe I got some spurious entry on serial port when enter and exit from sleep each second. Anyway, serial port are unusable when sleeping, I disable serial handling to not got weird thing.
Here part of my code, simple repeater/main.cpp
void HandleSerialCLI()
{
// Handle Serial CLI
int len = strlen(command);
// command must stay NUL-terminated within its bounds. If it ever isn't,
// strlen() above can return >= sizeof(command) and the loop below would then
// index past the buffer, so clamp defensively.
if (len >= (int)sizeof(command)) {
command[0] = 0;
len = 0;
}
while (Serial.available() && len < sizeof(command)-1) {
char c = Serial.read();
if (c != '\n') {
command[len++] = c;
command[len] = 0;
Serial.print(c);
}
if (c == '\r') break;
}
if (len == sizeof(command)-1) { // buffer full: treat as a completed line
command[sizeof(command)-2] = '\r'; // place end-of-line marker inside the buffer
command[sizeof(command)-1] = 0; // keep the buffer NUL-terminated
}
if (len > 0 && command[len - 1] == '\r') { // received complete line
Serial.print('\n');
command[len - 1] = 0; // replace newline with C string null terminator
char reply[160];
reply[0] = 0;
#ifdef ETHERNET_ENABLED
if (!ethernet_handle_command(command, reply)) {
the_mesh.handleCommand(0, command, reply);
}
#else
the_mesh.handleCommand(0, command, reply); // NOTE: there is no sender_timestamp via serial!
#endif
if (reply[0]) {
Serial.print(" -> "); Serial.println(reply);
}
command[0] = 0; // reset command buffer
}
}
void loop() {
bool board_is_sleeping = false;
if(board_is_sleeping == false) HandleSerialCLI();
board.loop(); // let the board feed its watchdog, run periodic housekeeping
#ifdef ETHERNET_ENABLED
ethernet_loop_maintain();
if (ethernet_read_line(ethernet_command, sizeof(ethernet_command))) {
char reply[160];
reply[0] = 0;
if (!ethernet_handle_command(ethernet_command, reply)) {
the_mesh.handleCommand(0, ethernet_command, reply);
}
ethernet_send_reply(reply);
ethernet_command[0] = 0;
}
#endif
#if defined(PIN_USER_BTN) && defined(SEEED_SENSECAP_SOLAR_H) && !defined(DISPLAY_CLASS)
// Hold the user button to power off the SenseCAP Solar repeater.
int btnState = digitalRead(PIN_USER_BTN);
if (btnState == LOW) {
if (userBtnDownAt == 0) {
userBtnDownAt = millis();
} else if ((unsigned long)(millis() - userBtnDownAt) >= USER_BTN_HOLD_OFF_MILLIS) {
Serial.println("Powering off...");
board.powerOff(); // does not return
}
} else {
userBtnDownAt = 0;
}
#endif
the_mesh.loop();
sensors.loop();
#ifdef DISPLAY_CLASS
ui_task.loop();
#endif
rtc_clock.tick();
#ifdef HAS_EXTERNAL_WATCHDOG
external_watchdog.loop();
#endif
if(the_mesh.getNodePrefs()->powersaving_enabled == false)
{
board_is_sleeping = false;
}
else
{
if(!the_mesh.hasPendingWork())
{
#if defined(NRF52_PLATFORM)
board.sleep(0); // nrf ignores seconds param, sleeps whenever possible
#else
if (the_mesh.millisHasNowPassed(POWERSAVING_FIRSTSLEEP_SECS * 1000)) // To check if it is time to sleep
{
//Serial.print("S"); Serial.flush(); delay(1);
board.sleep(1); // Sleep. Wake up after a while or when receiving a LoRa packet
board_is_sleeping = true;
//delay(1); delay.print("W");
}
#endif
}
}
}
- Vorherrschende Sprache
- C
- Sterne
- 3.9k
- Forks
- 1.5k
- Ø Merge
- 2 T. 19 Std.
- Gemergte PRs (30 T.)
- 61
Entwicklungsumgebung
Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus meshcore-dev/MeshCore
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
meshcore-dev/MeshCore#4015 ·
Maintainer antworten meist innerhalb von 2 Tagen
-
CMD_SET_DEFAULT_FLOOD_SCOPE leaves an older, longer name's tail after the new nameEvtl. vergeben Ein verknüpfter Pull Request ist offen oder bereits gemergt. Offen
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 88/100
meshcore-dev/MeshCore#3891 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 2 Tagen
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 64/100
meshcore-dev/MeshCore#3826 ·
Maintainer antworten meist innerhalb von 2 Tagen
-
App Preset Australia: NTOffen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
meshcore-dev/MeshCore#3825 ·
Maintainer antworten meist innerhalb von 2 Tagen
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
meshcore-dev/MeshCore#3781 ·
Maintainer antworten meist innerhalb von 2 Tagen
Alle Issues in meshcore-dev/MeshCore
Ähnliche Issues
-
CF_CFDP_S_SendFileData computes the file checksum from the SB buffer after CFE_SB_TransmitBufferOffen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
-
needs triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
389ds/389-ds-base#8251 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug data-types
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
ClickHouse/clickhouse-cpp#645 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
ROCm/hrx-system#3628 ·
Maintainer antworten meist innerhalb von 1 Tag