Closed rprr closed 5 years ago
How are you exiting rshell? When you exited rshell, was the board still at the REPL prompt? Or was it running a program? What command line options are you using when you start rshell? If you exit rshell can you connect with another terminal program? (i.e. putty, picocom, etc)] When you start rshell the second time, could you try adding the -d option and reporting back what gets output?
I usually exit rshell via ctrl-d or exit. The problem happens even if I don't enter repl.
$ sudo rshell -a -d --buffer-size=32 -p /dev/ttyUSB0 Debug = True Port = /dev/ttyUSB0 Baud = 115200 User = micro Password = python Wait = 0 nocolor = 0 binary = 1 Timing = 0 Quiet = 0 Buffer_size = 32 Cmd = [] Connecting to /dev/ttyUSB0 ... ----- About to send 304 bytes of code to the pyboard ----- def testunhexlify(): """Checks the micropython firmware to see if ubinascii.unhexlify exists.""" import ubinascii try: = ubinascii.unhexlify return True except: return False output = test_unhexlify() if output is None: print("None") else: print(output)
MicroPython has unhexlify ----- About to send 222 bytes of code to the pyboard ----- def listdir(dirname): """Returns a list of filenames contained in the named directory.""" import os return os.listdir(dirname) output = listdir('/') if output is None: print("None") else: print(output)
----- About to send 386 bytes of code to the pyboard ----- def set_time(rtc_time): rtc = None try: import pyb rtc = pyb.RTC() rtc.datetime(rtc_time) except: try: import machine rtc = machine.RTC() rtc.datetime(rtc_time) except: pass output = set_time((2018, 12, 2, 7, 12, 33, 35, 0)) if output is None: print("None") else: print(output)
----- About to send 292 bytes of code to the pyboard ----- def board_name(default): """Returns the boards name (if available).""" try: import board name = board.name except ImportError: name = default return repr(name) output = board_name('pyboard') if output is None: print("None") else: print(output)
----- About to send 334 bytes of code to the pyboard ----- def get_time_epoch(): """Determines the epoch used by the MicroPython board.""" import time try: return time.gmtime(0) except: """Assume its a pyboard, with an epoch of 2000.""" return (2000, 1, 1, 0, 0, 0, 0, 0) output = get_time_epoch() if output is None: print("None") else: print(output)
Welcome to rshell. Use Control-D (or the exit command) to exit rshell. /home/ramp> Executing "" /home/ramp> Executing "EOF"
(xenial)ramp@localhost:~$ sudo rshell -a -d --buffer-size=32 -p /dev/ttyUSB0 Debug = True Port = /dev/ttyUSB0 Baud = 115200 User = micro Password = python Wait = 0 nocolor = 0 binary = 1 Timing = 0 Quiet = 0 Buffer_size = 32 Cmd = [] Connecting to /dev/ttyUSB0 ... ----- About to send 304 bytes of code to the pyboard ----- def testunhexlify(): """Checks the micropython firmware to see if ubinascii.unhexlify exists.""" import ubinascii try: = ubinascii.unhexlify return True except: return False output = test_unhexlify() if output is None: print("None") else: print(output)
b'\x04\xff' Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/rshell/main.py", line 1197, in connect ip_address = socket.gethostbyname(port) socket.gaierror: [Errno -2] Name or service not known
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/bin/rshell", line 11, in
When I try picocom, I don't get the repl prompt even after I type enter a few times.
Thanks for the report, I'll see if I can figure out what's happening.
Ok, I tried on my Mac. No problems connecting and reconnecting. My problems were happening on 1) Raspberry Pi and 2) Crouton on a Chromebook. Both have arm processors and are running arm version of linux. Maybe there is an issue with the USB/Serial driver for the CP210X chipset. The other boards have the ch34x chipset, I think. Possibly a kernel driver issue?
And now it is worked properly. I'm perplexed. I have tried it a few times entering and exiting.
Log of activities for today:
Maybe the flash erasing did the trick this time. Puzzled. :)
Closing the issue for now.
And also, are you using the loboris version of ESP32 Micropython or the one from the micropython repository?
And also, are you using the loboris version of ESP32 Micropython or the one from the micropython repository?
I have used both but had problems irrespective. Now things appear to be fixed. I now make it a plan to erase_flash before write_flash.
Hi. I am experiencing this error connecting to a MaixPy. Exactly the same exception
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/rshell/main.py", line 1282, in connect
ip_address = socket.gethostbyname(port)
socket.gaierror: [Errno -2] Name or service not known
During handling of the above exception, another exception occurred:
I have managed to successfully connect once (randomly, after uninstalling and reinstalling rshell a few times and resetting the board). Remaining attempts have since failed.
I think that the error is rather misleading (and should be fixed). I think that the real cause is that rshell is unable to open the serial port, and then it falls back to thinking it should be a telnet connection.
One of the typical things that causes problems is when modemmanager is installed (under linux). It will open serial ports and send AT commands thinking that its a modem, and if rshell tries to connect while modemmanager has the port open then that causes problems.
Rather than unplugging and replugging the board, try just hitting the reset switch on the board in question.
I am having a strange issue with an ESP32. After a power cycle, I can connect via rshell to /dev/ttyUSB0. If I quit rshell and try to start again, it does not connect. The /dev/ttyUSB0 device is there but does not connect. If I power cycle it, the connection takes place easily the first time. Not sure what is wrong. I have tried various firmware versions (both stock and Loboris) but no luck.
Edit to add: This was a DEVKITV1 ESP32 module.
Somehow upon exit from rshell, it seems to set the board into a state where the solution seems to be to power/cycle to the ESP32.
I tried with a couple other TTGo ESP32 modules (with and without PSRAM) and those do not seem to display this issue.