ESP32 keeps rebooting #9930
-
Hello everybody, First of all sorry if this is in the wrong category. I'm new to GitHub and this forum, so please correct me if I'm doing something wrong. Firstly I placed this code in boot.py print("wifiboot") and the following code in main.py import network
wireless = network.WLAN(network.STA_IF)
wireless.active(True)
networks = wireless.scan()
print(networks) This worked properly. The code ran without errors and printed the networks. Then I copied this to main.py import network
wifi = network.WLAN(network.AP_IF)
wifi.active(True)
wifi.config(essid='ESP',authmode=network.AUTH_WPA_WPA2_PSK, password='password')
print(wifi.ifconfig()) When I uploaded this code and restarted the ESP, it started printing the following nonstop: wifiboot
Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.
Core 1 register dump:
PC : 0x4000127a PS : 0x00060130 A0 : 0x8013efee A1 : 0x3ffcd030
A2 : 0x3f41dbcc A3 : 0x00000000 A4 : 0x00000006 A5 : 0x3ffce6e4
A6 : 0x4008d4c0 A7 : 0x00000000 A8 : 0x00000057 A9 : 0x3ffccfe0
A10 : 0x00000001 A11 : 0x00000000 A12 : 0x3ffd6330 A13 : 0x00000000
A14 : 0x00000001 A15 : 0x3ffd6308 SAR : 0x00000010 EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000000 LBEG : 0x4000c2e0 LEND : 0x4000c2f6 LCOUNT : 0xffffffff
Backtrace:0x40001277:0x3ffcd030 0x4013efeb:0x3ffcd040 0x4013e925:0x3ffcd060 0x400f8663:0x3ffcd080 0x400dbdd3:0x3ffcd0e0 0x400e2679:0x3ffcd110 0x400e27a9:0x3ffcd130 0x40084789:0x3ffcd150 0x400dbd66:0x3ffcd1f0 0x400e2679:0x3ffcd260 0x400e26a2:0x3ffcd280 0x400efbca:0x3ffcd2a0 0x400eff71:0x3ffcd330 0x400d4cea:0x3ffcd350
ELF file SHA256: 00495403985fb7e0
Rebooting...
ets Jun 8 2016 00:22:57
rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:4540
ho 0 tail 12 room 4
load:0x40078000,len:12344
ho 0 tail 12 room 4
load:0x40080400,len:4124
entry 0x40080680 Because of that, I couldn’t interrupt it the program. I tried to stop it with Visual Studio Code and in Thonny with the stop-button, but that didn’t work I couldn't upload a new program to it either. Also, I can't type anything in the terminal. The hard and soft reset buttons are disabled too. I tried a different USB cable and a different USB port, but it made no difference. Does anyone have an idea how I can solve this? (And what did I do wrong and how can I prevent this in the future?) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I have no idea what causes the reboot. To recover from the boot loop, you will need to erase the flash and install micropython again. For further experiments, it is good practice to have a For myself, I decided that I will not touch main.py or boot.py until my application runs somewhat stable. Therefore, my code goes into a file My standard main.py reads: import machine
import time
def main():
run = True
cause = machine.reset_cause()
if cause == machine.SOFT_RESET:
print("main() BOOT: soft reset")
run = False
# do nothing, drop to REPL
elif cause == machine.DEEPSLEEP_RESET:
print("main() BOOT: deep sleep reset")
elif cause == machine.PWRON_RESET:
print("main() BOOT: PWRON_RESET") # e.g. machine.PWRON_RESET
time.sleep(10)
elif cause == machine.WDT_RESET:
print("main() BOOT: WDT_RESET")
else:
pass
if run:
import app
app.run()
print("main(): drop to repl") |
Beta Was this translation helpful? Give feedback.
I have no idea what causes the reboot.
To recover from the boot loop, you will need to erase the flash and install micropython again.
For further experiments, it is good practice to have a
sleep(5)
or similar at the beginning of main(), so you have some time to interrupt the thing for cases like the one you just found.For myself, I decided that I will not touch main.py or boot.py until my application runs somewhat stable. Therefore, my code goes into a file
app.py
and I'm running the my tests by typingimport app; app.run()
into the REPL.My standard main.py reads: