New version of rshell with better startup for ESP8266 and ESP32

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
Post Reply
User avatar
dhylands
Posts: 3295
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

New version of rshell with better startup for ESP8266 and ESP32

Post by dhylands » Thu Mar 28, 2019 8:57 pm

I just release version 0.0.21 of rshell.

It turns out that some ESP8266 and EPS32 boards reset when you open the serial port, and the verbage printed out at startup was confusing rshell trying to get a REPL prompt.

rshell now send a Control-C followed by RETURN several times while waiting for the >>> from MicroPython to show up.

None of my boards reset when opening the serial port, so I simulated it by tweaking the RTS and DTR lines immediately after opening the serial port.

I'd love for somebody who previously had issues; typically hanging at the 'Testing if ubinascii.unhexlify exists ...' would test this version.

Some people worked around this by adding a delay in pyboard.py.

Thanks

cefn
Posts: 228
Joined: Tue Aug 09, 2016 10:58 am

Re: New version of rshell with better startup for ESP8266 and ESP32

Post by cefn » Sat Mar 30, 2019 11:47 am

My suspicion is that some serial drivers send the reset on connect, as it only seems to affect some OS. Linux is unaffected by this behaviour. Mac OS is affected by the behaviour. Can't remember for Windows.

It's a real pain since if there is a main.py I am used to interactively killing the micropython script to make e.g. ampy put work (which relies on a responsive console to do file upload). Unfortunately ampy put then makes a connection, which restarts the board, which triggers main.py and makes the console unresponsive again.

If rshell is intelligently handling this, I'll probably switch vanguard put to use rshell instead...
https://github.com/vgkits/vanguard-cli/ ... __.py#L210

I already wrap rshell elsewhere and it's a dependency already so people don't have to install it.

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

Re: New version of rshell with better startup for ESP8266 and ESP32

Post by kevinkk525 » Sat Mar 30, 2019 1:53 pm

For me the OS didn't make a difference and it seems to be hardware dependent. The one esp32 "doit esp32 devkit" does reset on connect, the other devices I have don't.

However the latest version fixes the problem and works great.
Kevin Köck
Micropython Smarthome Firmware (with Home-Assistant integration): https://github.com/kevinkk525/pysmartnode

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

Re: New version of rshell with better startup for ESP8266 and ESP32

Post by pythoncoder » Mon Apr 01, 2019 10:08 am

This is a big improvement. There is still a minor issue with ESP32 if you exit rshell and then attempt to reconnect: it either fails to connect or hangs trying to do so. I'm using an Espressif ESP32-DEVKITC with ESP-WROOM-32.

The workround is simple: press the reset button before attempting to reconnect.

Code: Select all

$ rsusb
Using buffer-size of 30
Connecting to /dev/ttyUSB0 (buffer-size 30)...
Trying to connect to REPL ....................Unable to connect to REPL
Welcome to rshell. Use Control-D (or the exit command) to exit rshell.

No MicroPython boards connected - use the connect command to add one
I use the following to connect to ESPx

Code: Select all

alias rsusb='rshell -p /dev/ttyUSB0 --editor nano --buffer-size=30 -a'
Peter Hinch

bortunac
Posts: 1
Joined: Sat Jan 18, 2020 12:36 am

Re: New version of rshell with better startup for ESP8266 and ESP32

Post by bortunac » Sat Jan 18, 2020 1:22 am

Thank you ! WAW!!
Great tool that opens the gate from IDE editing to esp flash.
I wil try this path
windows + NETBEANS editing esp32/ directory on remote (raspberry-pi + esp32 on /dev/ttyUSB0)
INCRON watching esp32/ and run push.sh
rshell -p /dev/ttyUSB0 | (wait ???) rsync esp32/ /pyboard | exit

Post Reply