uPyCraft looses connection to ESP32

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
ajocius
Posts: 83
Joined: Mon Feb 19, 2018 6:31 am

uPyCraft looses connection to ESP32

Post by ajocius » Tue Jan 01, 2019 3:37 pm

Hi, I have followed great tutorial to get short micropython code on ESP32 from here:
https://randomnerdtutorials.com/micropy ... 2-esp8266/

After trying and failing for a while I got it working finally. However, during that process I came several times to the situation where uPyCraft was not seeing or recognizing software on ESP32 and it was suggesting me to burn firmware. First i did it couple of times, then it works for a while and suddenly looses ESP32 again. It still sees COM port that ESP32 is connected to, PC also shows that specific COM PORT active.
Since that ESP32 is programmed to publish simple mqtt message every 5 sec, I can still see messages coming to mqtt broker. Meaning that ESP32 does what it is intended to do, so it has all files in tact.
I have thought usb cable is faulty. It can not be that it is just a power usb cable (without data) as I used same cable to program it. But I tried several cables anyway, same result. I have then thought that PC USB might not provide enough power to ensure communication, so I tried different USB on same PC. PC recognizes also I see COM port appear in uPyCraft, however, when I select it uPyCraft suggest me to burn firmware. I also tried external USB bridge with separate power supply, still the same.
So I got stuck a bit. Could that be that bitrate set in COM port settings might have something to do with it? I see that uPyCraft under Tools, Preferences, Serial baud is set by default on 115 200 ( I ceckon that is bits per second), while PC COM port settings has 9 600 bits per second.
Any thoughts?
I have then tried uPyLoader IDE and that connects successfully and sees/opens files inside ESP32. So it must be something wrong with uPyCraft settings I guess. I prefer uPyCraft due to its editor, that looks better than uPyLoader.

NilsBe
Posts: 3
Joined: Sun Jan 06, 2019 10:47 pm

Re: uPyCraft looses connection to ESP32

Post by NilsBe » Mon Jan 07, 2019 11:23 am

I have the same issue here. It's definitely not a cable problem.

A_plan
Posts: 1
Joined: Sun Feb 10, 2019 8:21 pm

Re: uPyCraft looses connection to ESP32

Post by A_plan » Sun Feb 10, 2019 8:26 pm

I have the same problem (WIN10, uPyCraft 1.1)

wangshujun@tom.com
Posts: 61
Joined: Fri Feb 15, 2019 9:22 am

Re: uPyCraft looses connection to ESP32

Post by wangshujun@tom.com » Fri Feb 15, 2019 9:38 am

Yesterday I had the same problem. The solution was to rename boot.py in other software.

The reason for the problem is that the time from the start of the connection to reset the target board to the appearance of Python prompts exceeds the maximum waiting time of the software.

ajocius
Posts: 83
Joined: Mon Feb 19, 2018 6:31 am

Re: uPyCraft looses connection to ESP32

Post by ajocius » Tue Feb 26, 2019 12:14 pm

Not sure I follow your solution... boot.py should remain unchanged on ESP32 board. Were are you renaming it and why?

Larry
Posts: 2
Joined: Tue Apr 09, 2019 10:04 am

Re: uPyCraft looses connection to ESP32

Post by Larry » Tue Apr 09, 2019 10:10 am

Hello
I am suffering identical issues with uPyCraft v1.1
except i am using: XC3802 WiFi Mini ESP8266 Main Board.

If you erase the firmware and install it again then you can have a connection with the board for a short while.
then you get disconnected without any message, and it becomes impossible to reconnect to the board.
the code loaded behaves correctly, but no way to reconnect to edit it again unless you re-flash the firmware...

sounds like identical issue to the author of this post
Has anybody solved it?

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: uPyCraft looses connection to ESP32

Post by Roberthh » Tue Apr 09, 2019 11:12 am

If the esp8266 works fine, and uPyCraft fails, use another tool to work with the ESP8266. For instance rshell. That might not be shiny, but it works.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: uPyCraft looses connection to ESP32

Post by pythoncoder » Wed Apr 10, 2019 5:36 am

I'll second that vote for rshell.
Peter Hinch
Index to my micropython libraries.

Larry
Posts: 2
Joined: Tue Apr 09, 2019 10:04 am

Re: uPyCraft looses connection to ESP32

Post by Larry » Thu Apr 11, 2019 1:44 am

[quote=Larry post_id=35639 time=1554804613 user_id=5177]
Hello
I am suffering identical issues with uPyCraft v1.1
except i am using: XC3802 WiFi Mini ESP8266 Main Board.

If you erase the firmware and install it again then you can have a connection with the board for a short while.
then you get disconnected without any message, and it becomes impossible to reconnect to the board.
the code loaded behaves correctly, but no way to reconnect to edit it again unless you re-flash the firmware...

sounds like identical issue to the author of this post
Has anybody solved it?
[/quote]

Hello, I found that WEBREPL is able to connect to a esp8266 that has stopped letting you connect in uPyCraft v1.1
https://micropython.org/webrepl/ (keeping in mind that you must have added connect to station code in the boot.py for webrepl to work)
follow the guide: https://docs.micropython.org/en/latest/ ... asics.html

Back to the problem.
but once it connects you get a frozen >>>>
so i hit Control+C which will raise a KeyboardInterrupt exception and break out of any loop. and also tell you where it broke out from.
it said, main.py line 8... whatever i got the >>>> to unfreeze so.
>>>> import uos
>>>> uos.listdir() # tells you whats loaded on the ESP8266
>>>> uos.remove("main.py") # this will delete the main.py that is causing uPyCraft to not let you connect..

If you are actually good at this stuff unlike me then help correct this...
but i think main.py being loaded to esp8266 causes issues for uPyCraft when it has a while True: in it
and many tutorials ask you to create the main.py with a while True: to blink an LED forever.
WEBREPL gets around it by allowing you to connect and doing the control+C

if you dont want to lose you main.py file do
>>>> uos.rename("main.py","SomeotherName.py")

Then reboot the board, reboot uPyCraft because you are paranoid like me and then try connect again and it should work...

in consultation, if you want to use uPyCraft
re flash the board, follow the tutorial that allows you to use WEBREPL and dont use main.py with a while True:
https://docs.micropython.org/en/latest/ ... /repl.html

I am a total beginner by the way

chrissy_ast
Posts: 1
Joined: Sat Apr 13, 2019 7:33 pm

Re: uPyCraft looses connection to ESP32

Post by chrissy_ast » Sat Apr 13, 2019 7:35 pm

So the only solution is not to have a method which uses while(true) ?

Post Reply