Problems connecting with rshell

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
kevinkk525
Posts: 969
Joined: Sat Feb 03, 2018 7:02 pm

Problems connecting with rshell

Post by kevinkk525 » Tue Mar 26, 2019 8:58 am

I am using the daily firmware for the ESP32 and very often I have problems connecting with rshell
(nothing running on the esp, connecting with putty works fine every time):

Code: Select all

rshell -p /dev/ttyS5 -a
Connecting to /dev/ttyS5 ...
b'\x1b[0;32mI (426) cpu_start: Pro cpu up.\x1b[0m\r\n\x1b[0;32mI (427) cpu_start: Application information:\x1b[0m\r\n\x1b[0;32mI (427) cpu_start: Compile time:     00:43:59\x1b[0m\r\n\x1b[0;32mI (429) cpu_start: Compile date:     Mar 25 2019\x1b[0m\r\n\x1b[0;32mI (434) cpu_start: ESP-IDF:          v3.3-beta1-268-g5c88c5996\x1b[0m\r\n\x1b[0;32mI (441) cpu_start: Single core mode\x1b[0m\r\n\x1b[0;32mI (445) heap_init: Initializing. RAM available for dynamic allocation:\x1b[0m\r\n\x1b[0;32mI (452) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM\x1b[0m\r\n\x1b[0;32mI (458) heap_init: At 3FFB92B0 len 00026D50 (155 KiB): DRAM\x1b[0m\r\n\x1b[0;32mI (464) heap_init: At 3FFE0440 len 0001FBC0 (126 KiB): D/IRAM\x1b[0m\r\n\x1b[0;32mI (471) heap_init: At 40078000 len 00008000 (32 KiB): IRAM\x1b[0m\r\n\x1b[0;32mI (477) heap_init: At 400928AC len 0000D754 (53 KiB): IRAM\x1b[0m\r\n\x1b[0;32mI (483) cpu_start: Pro cpu start user code\x1b[0m\r\n\x1b[0;32mI (54) cpu_start: Starting scheduler on PRO CPU.\x1b[0m\r\nOSError: [Errno 2] ENOENT\r\nMicroPython v1.10-230-ge0c6dfe90 on 2019-03-25; ESP32 module with ESP32\r\nType "help()" for more information.\r\n>>> '
Traceback (most recent call last):
  File "/home/kevin/.local/lib/python3.6/site-packages/rshell/main.py", line 1197, in connect
    ip_address = socket.gethostbyname(port)
socket.gaierror: [Errno -5] No address associated with hostname

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/kevin/.local/bin/rshell", line 11, in <module>
    sys.exit(main())
  File "/home/kevin/.local/lib/python3.6/site-packages/rshell/command_line.py", line 4, in main
    rshell.main.main()
  File "/home/kevin/.local/lib/python3.6/site-packages/rshell/main.py", line 2730, in main
    real_main()
  File "/home/kevin/.local/lib/python3.6/site-packages/rshell/main.py", line 2692, in real_main
    connect(args.port, baud=args.baud, wait=args.wait, user=args.user, password=args.password)
  File "/home/kevin/.local/lib/python3.6/site-packages/rshell/main.py", line 1203, in connect
    connect_serial(port, baud=baud, wait=wait)
  File "/home/kevin/.local/lib/python3.6/site-packages/rshell/main.py", line 1227, in connect_serial
    dev = DeviceSerial(port, baud, wait)
  File "/home/kevin/.local/lib/python3.6/site-packages/rshell/main.py", line 1473, in __init__
    Device.__init__(self, pyb)
  File "/home/kevin/.local/lib/python3.6/site-packages/rshell/main.py", line 1280, in __init__
    elif not self.remote_eval(test_unhexlify):
  File "/home/kevin/.local/lib/python3.6/site-packages/rshell/main.py", line 1390, in remote_eval
    return eval(self.remote(func, *args, **kwargs))
  File "/home/kevin/.local/lib/python3.6/site-packages/rshell/main.py", line 1368, in remote
    self.pyb.enter_raw_repl()
  File "/home/kevin/.local/lib/python3.6/site-packages/rshell/pyboard.py", line 187, in enter_raw_repl
    raise PyboardError('could not enter raw repl')
rshell.pyboard.PyboardError: could not enter raw repl
Can someone point me to a solution for this?
I have no problems connecting to my esp8266s.
Also connecting directly after flashing a firmware to the esp32 works fine.

For flashing I have to reset the esp multiple times too until it connects properly.
Kevin Köck
Micropython Smarthome Firmware (with Home-Assistant integration): https://github.com/kevinkk525/pysmartnode

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

Re: Problems connecting with rshell

Post by pythoncoder » Wed Mar 27, 2019 8:44 am

Assuming your main.py isn't starting any code, I wonder if you might have hardware problems. What board are you using? The ESP32 is quite power hungry and I've found it doesn't tolerate long USB leads. I've been too lazy to check, but I'd guess that long leads cause voltage drop or an unacceptable 0V offset.

I use --buffer-size=30 in my rshell args but I don't think that's the cause of this issue.
Peter Hinch
Index to my micropython libraries.

kevinkk525
Posts: 969
Joined: Sat Feb 03, 2018 7:02 pm

Re: Problems connecting with rshell

Post by kevinkk525 » Wed Mar 27, 2019 10:20 am

My main.py is not running, I just wait for the repl.
I'm using a "doit esp32 devkit v1", probably just another clone.
My cable has some length (2m) but this doesn't seem to be the problem.

I can connect fine directly after flashing a firmware.
If I then exit rshell and try connecting again, it already won't work with the exception above which also clearly says that the board did reset and the output has been read correctly. Something after this process fails.
With Putty I can connect to the board at any time without any problems.

It looks like the esp32 doesn't get into raw_repl and therefore the rshell connect fails although it works after initial firmware flashing.
Would be good if someone could reproduce the problem.

I raised the issue on github: https://github.com/dhylands/rshell/issues/83
Kevin Köck
Micropython Smarthome Firmware (with Home-Assistant integration): https://github.com/kevinkk525/pysmartnode

Post Reply