ESP32-MPY-Jama icon indicating copy to clipboard operation
ESP32-MPY-Jama copied to clipboard

esp32 board cant connect (Fixed)

Open incosa opened this issue 2 years ago • 64 comments

for windows 10 i installed your app and selected the com port that my board was on. then your app wouldn't connect to the board and said couldn't connect.

I can open putty or thonny and it will connect to the esp board with no problems.

is there something i am missing? i used the exe file from clicking on windows in the git page

incosa avatar Feb 07 '23 19:02 incosa

Same problem here. Wanted to try this out after seeing the Hackaday article. I can't seem to get it to connect. It's the AZ-Delivery Dev Kit.

Necromantic avatar Feb 09 '23 14:02 Necromantic

Hi @incosa, @Necromantic, I think I know the problem, MPY-Jama always connects to the serial port via a boad rate of 115200 bps. This is not necessarily accepted on all ESP32 cards and maybe yours. What did you select in the other tools please? I definitely need to add this in the next version.

jczic avatar Feb 09 '23 15:02 jczic

I confirm this issue. I tried to connect a couple of dozen different ESP32 boards (21 to be exact). None of them connect. It doesn't matter what settings I set in device manager, or whatever. It never connects. Putty e.g. on 115200 connects without problem at 115200.

IngmarG avatar Feb 10 '23 22:02 IngmarG

@IngmarG, what is your firmware on these boards ? The same ? It's not normal but I can understand that with the type of boards and the type/version of firmware. Thank you again.

Other: Do you have a program running on your boards when you connect it?

jczic avatar Feb 11 '23 00:02 jczic

@IngmarG, what is your firmware on these boards ? The same ? It's not normal but I can understand that with the type of boards and the type/version of firmware. Thank you again.

Other: Do you have a program running on your boards when you connect it?

E.g. ESP-32 Dev Kit C V4 by AZ-Delivery, connected to the Arduino IDE (just connecting to the internet via my WiFi and getting the time) image

Now, trying to connect to the MPY-Jama IDE (first disconnected of course from Arduino), and powered down.

image

With result:

image and image

This happens with ALL devices, no matter what is running on it (Meshtastic, ESPHome, Arduino programs, Tasmota, ...)

IngmarG avatar Feb 11 '23 11:02 IngmarG

Am I correct in assuming that MPY-Jama can not flash itself for the first time? Meaning that I have to use esptool.py e.g. to flash the first binary?

Maybe that's the reason it won't connect?

IngmarG avatar Feb 11 '23 12:02 IngmarG

Can you start your ESP32, connect to it directly via putty and press CTRL+A to see if the REPL switches to RAW mode. If it works, can you copy/paste the contents of the REPL here? I think there is a difference in this area from what I have been able to test and I would have to see what it looks like on your end.

Concerning the firmware flash, MPY-Jama uses esptool. So you can flash an image without connect in first.

jczic avatar Feb 11 '23 15:02 jczic

By the way, you must have a firmware with MicroPython on your ESP32 beforehand because the serial connection is done via the MicroPython REPL, I didn't even think about it at the time. Obviously, on an ESP32 with another type of firmware, it will not work. (MPY = MicroPython)

-> MicroPython port to ESP32 GitHub

jczic avatar Feb 11 '23 16:02 jczic

Im using MP 1.19.1 i tried with 2 ftdi cables.

incosa avatar Feb 11 '23 16:02 incosa

@incosa, could you give me a screen shot from a standard serial term at the boot, after CTRL+A pressed please ? My mail is on my github account. Thank you šŸ‘šŸ» because I don't understand this problem.

jczic avatar Feb 11 '23 16:02 jczic

@incosa, could you give me a screen shot from a standard serial term at the boot, after CTRL+A pressed please ? My mail is on my github account. Thank you šŸ‘šŸ» because I don't understand this problem.

will do.

FYI i just tried another board i have with 1.18.1 and it worked. ill check our the 1.19.1 board and see what else i can find.

incosa avatar Feb 11 '23 17:02 incosa

By the way, you must have a firmware with MicroPython on your ESP32 beforehand because the serial connection is done via the MicroPython REPL, I didn't even think about it at the time. Obviously, on an ESP32 with another type of firmware, it will not work. (MPY = MicroPython)

-> MicroPython port to ESP32 GitHub

Kind of illogical as e.g. any other "OS" can flash over a pre-existent different one. One just needs to go into boor mode. I can flash any Arduino compiled image over Meshtastic, ESPHome or Tasmota for instance.

I'll give it a try, but where do I find an image precompiled that will work with any of the devices that I have (literally dozens of different brands, like Heltec, Espressif dev kit (from espressif), other dev kits form AZ-delivery, fakes from Aliexpress, ....

BTW: I am a KS backer of MicroPython.

IngmarG avatar Feb 11 '23 17:02 IngmarG

In fact @IngmarG, the software is dedicated to MicroPython functions but mainly for the ESP32 port. It simply uses the installed esptool (if it finds it) to flash a firmware image. In the end, I would like to extend it to as many cards as possible but since it's only the beginning, I couldn't check everything in the different firmwares and the way to communicate with the Raw REPL. I hope to be able to fix all the problems soon :) (KS backer ! Nice ! Do you have an idea for an another issue that I have : https://github.com/micropython/micropython/issues/10718 ?)

jczic avatar Feb 11 '23 19:02 jczic

@incosa : I've the 1.19.1 with IDF v4.4.1 and it works but indeed, there must be something different for the REPL. The binary version is not up to date but the latest commits also fix the fact that it can interrupt a running program to connect.

jczic avatar Feb 11 '23 19:02 jczic

In fact @IngmarG, the software is dedicated to MicroPython functions but mainly for the ESP32 port. It simply uses the installed esptool (if it finds it) to flash a firmware image. In the end, I would like to extend it to as many cards as possible but since it's only the beginning, I couldn't check everything in the different firmwares and the way to communicate with the Raw REPL. I hope to be able to fix all the problems soon :)

(KS backer ! Nice ! Do you have an idea for an another issue that I have : micropython/micropython#10718 ?)

Managed to flash it (esp32-20220618-v1.19.1 from https://micropython.org/download/esp32/

Now let's see if I can play around a bit.

As to what concerns your other issue: Sorry, I'm an old school programmer: Algol68, ADA, Fortran, Pascal, Delphi, Basic, Forth, Prolog, a lot of assemblers, and my first one was actually hand coding to hex on 1802, 6502, and especially SC/MP (INS8060).

Being retired this is an (obsessive) pass time.

IngmarG avatar Feb 11 '23 23:02 IngmarG

Hey! Excellent @IngmarG :) Me C/C++, ASM, Basic, Pascal, Delphi, .Net, J2EE, Javascript, Python, Web... You know the ASN1 logic ? It' fun.. I loved Delphi at it startup! And I loved .Net (C#) just after.

Coding, this has been over than 30 years old for me... :'D

jczic avatar Feb 12 '23 23:02 jczic

I've found on a Windows 10 PC that the first connection attempt to the ESP32 fails but a second attempt usually works. I don't do anything between the attempts. I just try to connect, it fails, and then I hit connect again and it works.

rdagger avatar Feb 19 '23 18:02 rdagger

Hi @rdagger, Do you connect it via auto-serial port search or directly by the good serial port? I've Windows 10 but I had not see that... I can retry the first connection 2 times but for auto-search, that can be long. Also, if a program running on the ESP32, the last release (v1.0.3) doesn't halt the current process but the next version do it correctly.

jczic avatar Feb 20 '23 00:02 jczic

@jczic I usually specify the actual serial port, but I have tried automatic port detection too. Regardless, the first connection attempt always fails. However, the second attempt usually works. I just tested it both ways with a freshly wiped ESP32.

rdagger avatar Feb 20 '23 00:02 rdagger

@rdagger: Either I can reproduce it at home, or if I dont't find the bug, it could be interesting to test, on your side, a modified source file with specific error codes (that I'll add) in order to find where it can come from...

jczic avatar Feb 20 '23 01:02 jczic

No problem, I can test whatever you want.

rdagger avatar Feb 20 '23 01:02 rdagger

Ok, thank you @rdagger! I'll send you a source file tomorrow

jczic avatar Feb 20 '23 01:02 jczic

Just @rdagger, when your connection fails, is it instantaneous, after 3 seconds or rather 5 seconds?

jczic avatar Feb 20 '23 01:02 jczic

@jczic 3 seconds

rdagger avatar Feb 20 '23 01:02 rdagger

Hello @rdagger, @IngmarG, I worked on this problem and maybe the bug is now fixed. I'm not 100% sure because I can't reproduce it but it's a communication problem with the mode change in the REPL. Do you want to try the latest sources (not the latest version) to check if the connection problem is still present?

(Commit https://github.com/jczic/ESP32-MPY-Jama/commit/d46b4aaf0bc5649f0b8608f741c7e367c661d3de)

jczic avatar Feb 20 '23 10:02 jczic

@jczic I tried the latest sources and unfortunately the problem still persists. First try fails. Second try works. It only fails on the first try after the ESP32 board is plugged into the USB port. After a successful connection you can exit and restart the program and it will connect on the first try. However, if you disconnect, unplug the ESP32 and then plug it back in then the first connection attempt will fail.

rdagger avatar Feb 21 '23 06:02 rdagger

@rdagger, hmm it's very strange, that's works on my Windows 10 and MacOS on many cards. I'm looking but I can't find it. Apparently, it does not manage to detect that the RAW REPL mode has been passed the first time.

jczic avatar Feb 22 '23 08:02 jczic

Please take a look at the Pymakr repositories: https://github.com/search?q=org%3Apycom+pymakr I use Pymakr2 in VS Code and its connection works very well in Windows 10.

rdagger avatar Feb 22 '23 16:02 rdagger

Sorry Jean-Christophe (and others),

I’m currently not following up on this issue. No time.

But please keep me in the loop.

Ingmar

From: rdagger @.> Sent: woensdag 22 februari 2023 17:58 To: jczic/ESP32-MPY-Jama @.> Cc: IngmarG @.>; Mention @.> Subject: Re: [jczic/ESP32-MPY-Jama] esp32 board cant connect (Issue #11)

Please take a look at the Pymakr repositories: https://github.com/search?q=org%3Apycom+pymakr I use Pymakr2 in VS Code https://github.com/pycom/pymakr-vsc and its connection works very well in Windows 10.

— Reply to this email directly, view it on GitHub https://github.com/jczic/ESP32-MPY-Jama/issues/11#issuecomment-1440424831 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ACRJHVGAMLJLAKHXMBKAUM3WYZASDANCNFSM6AAAAAAUULBSWI . You are receiving this because you were mentioned. https://github.com/notifications/beacon/ACRJHVGMCCXARPFJ5WEHMBLWYZASDA5CNFSM6AAAAAAUULBSWKWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTSV3MRX6.gif Message ID: @.*** @.***> >

IngmarG avatar Feb 22 '23 22:02 IngmarG

Re @rdagger, Could you try again the last update on the repo (not the binaries)? The method of switching between REPL modes has been changed. Thank you very much! šŸ„‡

jczic avatar Feb 22 '23 23:02 jczic