Connection fails to ESP32, with MicroPython 1.9.4 after uploading python code

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
OutoftheBOTS_
Posts: 847
Joined: Mon Nov 20, 2017 10:18 am

Re: Connection fails to ESP32, with MicroPython 1.9.4 after uploading python code

Post by OutoftheBOTS_ » Sat Aug 04, 2018 6:59 am

If your ESP32 is crashing because of the code in boot.py the only way that I know to fix this is use esptool to erase the ESP32 then reflash the MicroPython firmware.

guyd
Posts: 81
Joined: Fri Jul 20, 2018 6:08 am

Re: Connection fails to ESP32, with MicroPython 1.9.4 after uploading python code

Post by guyd » Sat Aug 04, 2018 2:59 pm

OutoftheBOTS_ wrote:
Sat Aug 04, 2018 6:49 am
perhaps I don't understand you answer- but I don't see how it is relevant for what I asked ( my english ? ;) )
If I am understanding your problem it is that your ESP32 is crashing during boot up and not getting a repl. Is this correct????

When Micro-Python starts up it executes boot.py during boot up then after boot up has finished it executes main.py. If there is a problem in the code in boot.py it will not exit to repl but if there is a problem in the code in main.py it will exit to repl. This means you need to be very careful with the code you put in boot.py, so you are much better to put your startup code in main.py
No, that is not what I ment ( forgive my english ).
A code, including thread ( in charge of running a MQTT service )- causing ESP32, not to get connected using rshell. In order to gain access again, I just need to physically unplug and plug back ( a reset using on board button is not enough ).
When this code is running upon boot ( imported in main.py - since that is it purpose ), you can never get access again, only after re-flashing ESP to delete its entire content.

OutoftheBOTS_
Posts: 847
Joined: Mon Nov 20, 2017 10:18 am

Re: Connection fails to ESP32, with MicroPython 1.9.4 after uploading python code

Post by OutoftheBOTS_ » Sat Aug 04, 2018 10:27 pm

I just need to physically unplug and plug back ( a reset using on board button is not enough ).
Well that is unusual. I though that pressing the hard reset button worked by physically operating a transistor inside the ESP32 to cut the power to the ESP32 doing the same job as unplugging then replugging.

Ok a simple work around that you might be to add to your program that if it receives a MQTT message to quit then then exits by executing exit() fuction.

So the problem could either be with the ESP32 or with rshell. I would try anther shell like mpfshell and see if it works because if it does then it will tell you that it is a problem with rshell and not the ESP32.
Last edited by OutoftheBOTS_ on Mon Aug 06, 2018 8:16 am, edited 1 time in total.

User avatar
liudr
Posts: 211
Joined: Tue Oct 17, 2017 5:18 am

Re: Connection fails to ESP32, with MicroPython 1.9.4 after uploading python code

Post by liudr » Mon Aug 06, 2018 2:33 am

If you need telnet, you can try loboris firmware, which is working pretty pretty well with telnet.

Post Reply