Page 1 of 1

New version of rshell with better startup for ESP8266 and ESP32

Posted: Thu Mar 28, 2019 8:57 pm
by dhylands
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

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

Posted: Sat Mar 30, 2019 11:47 am
by cefn
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.

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

Posted: Sat Mar 30, 2019 1:53 pm
by kevinkk525
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.

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

Posted: Mon Apr 01, 2019 10:08 am
by pythoncoder
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'

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

Posted: Sat Jan 18, 2020 1:22 am
by bortunac
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

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

Posted: Wed Aug 19, 2020 1:36 am
by davef
When I run rshell on my ESP32 I get:

Code: Select all

> rshell
Welocome to rshell. Use Control-D to exit.
/home/dave
From the docs it appears you should end up at:

Code: Select all

.../micropython/rshell>
When I re-install rshell it appears to be in:

Code: Select all

Requirement already satisfied: rshell in /usr/local/lib/python3.7/dist-packages (0.0.28)
Do I make a link to it or have I messed up the install?

Thanks,
Dave

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

Posted: Wed Aug 19, 2020 11:05 am
by kinno
Really great release! Some of my esp-32s were affected by this. I will report back once I test it out.

Thanks again.

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

Posted: Wed Aug 19, 2020 12:20 pm
by pythoncoder
@davef There is nothing wrong with your installation: the rshell prompt shows the current directory wherever that may be.

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

Posted: Wed Aug 19, 2020 5:18 pm
by jcw
On macOS, I think the default is to have DTR inactive until the port is opened. If that is used by the ESP, then that might explain the reset-on-open behaviour.

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

Posted: Wed Aug 19, 2020 10:48 pm
by davef
jcw,
I assume that remark is for someone else.

Peter,
This is what happens when I run rshell:

Code: Select all

dave@dave-AOD255E:~$ sudo rshell -p /dev/ttyUSB0 --editor nano --buffer-size=30 -a
Using buffer-size of 30
Connecting to /dev/ttyUSB0 (buffer-size 30)...
Trying to connect to REPL  connected
Testing if ubinascii.unhexlify exists ... Y
Retrieving root directories ... /batt_voltage_values/ /boot.py/ /datalog.csv/ /myLogger.py/ /umail.py/ /webrepl_cfg.py/
Setting time ... Aug 20, 2020 10:43:07
Evaluating board_name ... pyboard
Retrieving time epoch ... Jan 01, 2000
Welcome to rshell. Use Control-D (or the exit command) to exit rshell.
/home/dave>
but when I do:

Code: Select all

 ls -l /
I get the root directory of the host computer. There is no /sd or /flash on my ESP32. The ESP32 has webrepl running and it is configured as an AP, is one of those conditions a problem?

rshell appears to find my files but I can't!

Update:
I found it in /pyboard

Thanks,
Dave