-
Notifications
You must be signed in to change notification settings - Fork 159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ESP8266 Micropython "Could not enter raw repl" #19
Comments
I have similar problem, but with NodeMCU DEVKIT V1.0 board (running MicroPython v1.8.7-7-gb5a1a20a3) Did you have any code on board running while trying to execute ampy command or any terminal opened? In my scenario, ampy (ls command) was not able to enter raw repl while code with virtual timer initialised was running on board. |
In my case, the cause was code on the board reading from UART 0. |
@g-sam What does it mean that it's reading from UART 0? Does it mean you just need to change something to read on a different UART? If yes, how?
I had been trying to solve the same problem with my ESP32 for two days now (I think I got the same issue on ESP8266 01 but I probably gave up). But then out of the blue I was able to make it work today. So when I plugin the board on my Macbook 2013, that's when I get this unable to enter REPL issue. But as soon as I plug it in on my Raspberry Pi, I am able to run the same ampy commands without issues! My immediate solution is:
By the way I got the same problem with rshell. I resolved the issue the same way! Some interesting observations:
|
I meant I had a sensor plugged into UART 0, which the USB also uses, so there was some kind of conflict. ESP8266 only has one UART-in, so you can't change it. Not sure about the ESP32 and curious if anyone can explain your observations |
I have the same issue on my Mac 10.12.3 with Wemos D1 mini
|
Hi, has anyone solved this issue? I'm trying to connect to ESP32 via serial monitor like this: I use Linux Mint 18, and the USB port is working right. Thanks for any help. Note 1: The first problem (screen command) was fixed. I solved it by attempting to connect to the ESP32 after having the sensors unplugged. It seems to be like there is an important hardware communication function on IO4 port. Note 2: The second issue was fixed, too. It was just the data cable. Sorry for the ignorance, but it seems to be like a power-bank cable is not that good for passing data. Ampy is working correctly. |
@sebasarango1180 One thing I discovered is it's important to state who the board maker is. The ESP32 I got from Makerfocus by Geekworm (https://www.amazon.com/dp/B06XXT9ZQZ/ref=cm_sw_r_cp_apa_WGMCzbWRTQC9Z) fails to load Micropython. However it works with Arduino. However the one from ESPRESSIF works ( https://www.amazon.com/dp/B01N0SB08Q/ref=cm_sw_r_cp_apa_FIMCzb8HV3CW0) with Micropython. I can list and read files with ampy and rshell. Edit: Ok it seems I forgot what I stated last time. The Geekworm doesn't load Micropython and won't run ampy on my Macbook. But it is able to load Micropython when it's via Raspberry pi and run ampy. But it still won't run Micropython programs. So it's still a failure for the Geekworm either way |
I've found a workaround for my ESP32 (from Makerfocus by Geekworm). Assumptions:
The Problem: I get the following error: "could not enter raw repl": The Workaround:
EDIT: time.sleep(0.5) works as well, below 0.5 I get the dreaded repl error
You should still be able to run ampy with your working boards because we've only added a delay here. Other Notes:
When I run picocom on both (ie. picocom /dev/tty.wchusbserial1a1210 -b115200), I can see the Micropython prompt, and I can enter REPL mode on both. So I know REPL mode works on BOTH boards. The issue is in the ampy/pyboard programs, and I think it's because of this piece of code:
This is essentially like a delay function. The question is should it work the same across all boards? Edit: I think my theory about the delay function is wrong. Because in both boards, the delay function does nothing. It doesn't make any difference. I think what's happening on my non-working board is it spits out extra text before it goes to the prompt. By adding a time.sleep(), the script will only go to REPL mode after the sleep is done (essentially that's when the extra text has been spitted out. The assumption is the extra text only consumes less than the time seconds stated in the time.sleep() argument) |
^ This is how I fixed my issue too! |
^ adding a |
just to pile on here. The addition of the time.sleep(1) also worked for NODE MCU ESP8266 . Has anyone sent this info to Adafruit? |
Thank you @markserrano915, your solution worked for me as well (Wemos D1 Mini). |
This is probably a good issue to push up to upstream micropython where the pyboard.py code comes from vs. just here in ampy. With all the different boards and hardware available it's hard to pick a good sleep that works for one but doesn't slow down others. Rather than play whack a mole with changing delays to ones which work let's see if upstream micropython might consider a different approach like perhaps a soft reset that skips running main app logic (why the enter raw repl currently does Ctrl-C twice, to stop any running main app). |
I had the same issue, I entered with picocom and realised that I had to press twice ctrl-A to enter raw repl. So I modified ampy as following and it started to work for my WEMOS LOLIN32 Lite. self.serial.write(b'\r\x01') # ctrl-A: enter raw REPL But sometimes I still have problems. Might be the delays yea. |
Same issue, same sleep(2) solution working with an ESP32-PICO-KIT V4. |
Even a delay of 3 seconds does nothing for me.
(Takes about 13 seconds) Running Picocom at the same time gives me outputs like
I guess this would indicate an unreliable connection, but it persists using different cables and text typed through Picocom gets recieved perfectly. Any ideas? Entering raw REPL via CTRL-A o my computer works perfectly and gives back a flawless |
@solarkraft may be the code running on the ESP is blocking it somehow or spitting out some stuff. I sometimes also get frustrated about ampy not copying over the files and then I just reflash the micropython binary and then it usually works again. I usually copy main.py and then then boot.py after everything else, as if you copy those the system will try to run the code from them and often for me it was failing to copy any other files after I uploaded boot and main. |
time.sleep(2) did it for me as well. |
@solarkraft any luck getting it working? I noticed that the pyboard.py tries to enter raw repl, then makes a soft reboot and then tries to enter raw repl again. It usually works for me, but now I am testing on Linux Windows and Mac OS, it seems to work on Linux and Windows, but on Mac OS the driver seems to reboot the ESP, so it will fail to enter raw repl. I am still investigating more into it. As I am working on an app to update software on the ESP, so I need to make it reliable. |
After some experimentation with my D1 Mini, I found the following made
You can express all these on the command line as options:
I found it easier to put those three lines into a
… after which |
@garthk thanks for sharing, works for me also on MAC OS. I realized also that the CH304 on MAC OS is reseting my ESP32 all the time when I initiate a serial connection, which sucks and makes ampy not work by default. But adding extra delays makes it work. |
I solved my issue. by reinstalling the firmware into the board. |
If the error still happens after trying before solutions, try to add a 100nF capacitor parallel to EN button as is described in Figure 4. Many development kits haven't this capacitor an it's necessary. |
remove Chinese from emp_*.py which will case UnicodeDecodeError
Hi! I get the same problem when I use ampy to work with pycom fipy device. Its pretty unreliable. Any solution related to ampy and fipy? Thanks. |
@mrajiullah I thought pycom had it's own utils. Do you still need ampy for pycom boards? Some good news - I've gotten an offer from Jaaga, who wants to sponsor this project. Hopefully, I can devote more time to solving this issue once we have that sorted out. |
Thanks for markserrano915. |
I was using another REPEL instance using picocom in the background and I didn't notice it. The issue went away by closing the other picocom instance |
I think I understand it and fixed it, at least for the pyboard.py that lives inside rshell. rshell now has a See dhylands/rshell#27 and the Pull Request linked from there. |
I have the same issue on macOS; I was used to running mpy on esp8266 where I could use |
Since adding a delay didn't help it to connect, I just connect via Putty to the COM Port, press Strg+C two times to get into the REPL by hand. Then I delete the main.py with the command |
me too i'm still working on this error, reinstall the firmware will fix this, but after flashing once, when you want to flash again this error occurs, so everytime i want to modify the code I have to reinstall the firmware which drives me crazy now...... |
first: os.remove('file running loop') |
I can confirm (like many others?) that the |
I'm using this board https://www.olimex.com/Products/IoT/MOD-WIFI-ESP8266-DEV/. When I try to run
"sudo ampy --port /dev/ttyUSB0 run test.py" or any other command, it says "Could not enter raw repl". When I enter that, micropython says "raw REPL; CTRL-B to exit".
The text was updated successfully, but these errors were encountered: