rshell hangs copying to pyboard

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
DougK
Posts: 9
Joined: Wed Aug 11, 2021 3:58 pm

rshell hangs copying to pyboard

Post by DougK » Mon Nov 15, 2021 3:51 am

I'm developing some library files for a robot that uses an ESP32 for control. Because the hardware is new and I'm pretty new to python I frequently need to download modified files from my PC to the ESP32 (an MH-ET Live board). I'm working on a Windows 10 machine and my ESP32 typically connects to COM10, although I've experienced this issue with several different boards and different com ports.

When I run

Code: Select all

rshell -p com10 
it always connects to the ESP32. But, when I do a

Code: Select all

cp file.py /pyboard/lib/file.py
it hangs about half the time. I've tried resetting the ESP, pulling the USB cable and re-inserting it, killing the cmd window and restarting it, etc., but have not found anything that works consistently. I've run an os.listdir from repl and the output is what I expected.

Does anyone have any suggestions on how to fix this? It takes a lot of extra time and typing every time a copy fails.

davef
Posts: 813
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

Re: rshell hangs copying to pyboard

Post by davef » Mon Nov 15, 2021 4:32 am

After:

Code: Select all

rshell -p com10 
what do you get if you then do;

Code: Select all

ls
After I invoke rshell (in Linux) I always change to:

Code: Select all

/pyboard/
before I do any copying or editing.

DougK
Posts: 9
Joined: Wed Aug 11, 2021 3:58 pm

Re: rshell hangs copying to pyboard

Post by DougK » Mon Nov 15, 2021 4:55 am

If I do

Code: Select all

ls 
after starting rshell I get a list of the files on my computer that are in the directory I started rshell from. This is multiple directories deep (i.e., somewhat long path). It sounds like you have a top level directory on your computer named /pyboard/ that you work from.

davef
Posts: 813
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

Re: rshell hangs copying to pyboard

Post by davef » Mon Nov 15, 2021 7:59 am

OK, the <ls> seems to work.

/pyboard/ is the top directory on the ESP32 using the standard Micropython image.

I don't have any experience with rshell on Windows ... hope someone else can help.

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

Re: rshell hangs copying to pyboard

Post by pythoncoder » Mon Nov 15, 2021 9:07 am

I have no experience of Windows but behaviour at the rshell prompt should be the same. An ESP32 shows up as /pyboard. Hence, at the rshell prompt

Code: Select all

> ls /pyboard
should list the contents of flash.

Code: Select all

> ls
will show you your current directory. So

Code: Select all

> cp myfile.py /pyboard/
will copy the file from your current PC directory to the ESP32 flash.

To connect to ESP32 I use this (which will need adapting for Windows):

Code: Select all

rshell -p /dev/ttyUSB0 --buffer-size=30 -a
Peter Hinch
Index to my micropython libraries.

DougK
Posts: 9
Joined: Wed Aug 11, 2021 3:58 pm

Re: rshell hangs copying to pyboard

Post by DougK » Mon Nov 15, 2021 8:30 pm

davef and Peter,

Thanks for the replies! The

Code: Select all

ls /pyboard
does what you'd expect - lists the contents of the flash on my ESP. I added the -a option when starting rshell, but it still hangs when copying. I'm copying .py files, which should be ascii, so I wouldn't have expected the -a to do much. My buffer size already defaulted to 32, but I tried 30 just to be sure. Copies still hang about half the time. cd and ls seem to work all the time, so I think the issue is some combination of Windows and cp, although I don't have a theory on what it could be.

If I do

Code: Select all

cd /pyboard
ls
I see the contents of flash on my ESP32. How do I get back to my computer?

Code: Select all

cd - 
tries to concatenate the path on my computer to /pyboard. I looked at the rshell readme on GitHub but didn't see a way to specify the computer in SOURCE or DEST. I thought maybe I could pull files down to the ESP rather than push from my computer in case that eliminated the problem, but I couldn't see how to do that.

Doug

davef
Posts: 813
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

Re: rshell hangs copying to pyboard

Post by davef » Mon Nov 15, 2021 8:51 pm

How do I get back to my computer?
I can only tell you how for Linux

Code: Select all

cd /home/davef
I would be a bit surprised if forward slashes would take you to a directory on a Windows box.

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

Re: rshell hangs copying to pyboard

Post by pythoncoder » Tue Nov 16, 2021 4:02 pm

Code: Select all

> cd ~
works under Linux to take me back to the PC.

In my use of rshell I rarely use cd: I generally stay in the location where I started, copying files from there to the device.
Peter Hinch
Index to my micropython libraries.

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: rshell hangs copying to pyboard

Post by dhylands » Thu Nov 18, 2021 12:02 am

Just a note about forward slashes. rshell only supports forward slashes and doesn't support backslashes at all.

Internally windows has always supported forward slashes (even dating back to Windows 3.0). It has only been command.com and cmd.exe which don't support forward slashes. Forward slashes work fine everywhere else in Windows.

DougK
Posts: 9
Joined: Wed Aug 11, 2021 3:58 pm

Re: rshell hangs copying to pyboard

Post by DougK » Thu Nov 18, 2021 4:52 am

Thanks to all for the help. I'm definitely smarter in my use of rshell. I did figure out how to get back to my computer, but the path on my computer is much longer than on the esp, so definitely easier to copy from the computer to the esp (much less typing). I had been including the drive identifier (e.g., d:) in the path, but that doesn't work).

But, I still have the issue where it hangs about half of the time, but only when copying files. Everything else seems to work as expected.

Doug

Post Reply