dhylands / rshell

Remote Shell for MicroPython
MIT License
944 stars 133 forks source link

Timeout Error with Raspberry Pi Pico - using version 0.0.29 #149

Open RyanGaudion opened 3 years ago

RyanGaudion commented 3 years ago

I'm using the most recent version released 2 days ago (0.0.29) on Windows 10 however I get timeouts whenever I try to copy files to my Pico. Here are the commands I have used:

rshell cd Desktop/ cp main.py /pyboard/main.py

I have also tried these variations of the rshell command:

rshell -a rshell -p COM3 --buffer-size 512 Both of which also timeout (timeout waiting for first EOF reception)

Saving the files through Thonny works as intended so the file itself shouldn't be an issue.

RyanGaudion commented 3 years ago

Copy of Command Line:

C:\Users\user>rshell
Connecting to COM3 (buffer-size 128)...
Trying to connect to REPL  connected
Retrieving sysname ... rp2
Testing if sys.stdin.buffer exists ... Y
Retrieving root directories ... /main.py/
Setting time ... Mar 01, 2021 20:22:50
Evaluating board_name ... pyboard
Retrieving time epoch ... Jan 01, 1970
Welcome to rshell. Use the exit command to exit rshell.
C:\Users\user> cd Desktop/
C:\Users\user/Desktop> cp main.py /pyboard/main.py
Copying 'C:\Users\user/Desktop/main.py' to '/pyboard/main.py' ...
Traceback (most recent call last):
  File "C:\Users\user\AppData\Roaming\Python\Python37\Scripts\rshell-script.py", line 11, in <module>
    load_entry_point('rshell==0.0.29', 'console_scripts', 'rshell')()
  File "C:\Users\user\AppData\Roaming\Python\Python37\site-packages\rshell\command_line.py", line 4, in main
    rshell.main.main()
  File "C:\Users\user\AppData\Roaming\Python\Python37\site-packages\rshell\main.py", line 3084, in main
    real_main()
  File "C:\Users\user\AppData\Roaming\Python\Python37\site-packages\rshell\main.py", line 3067, in real_main
    shell.cmdloop(cmd_line)
  File "C:\Users\user\AppData\Roaming\Python\Python37\site-packages\rshell\main.py", line 1872, in cmdloop
    cmd.Cmd.cmdloop(self)
  File "c:\program files (x86)\microsoft visual studio\shared\python37_64\lib\cmd.py", line 138, in cmdloop
    stop = self.onecmd(line)
  File "C:\Users\user\AppData\Roaming\Python\Python37\site-packages\rshell\main.py", line 1902, in onecmd
    self.onecmd_exec("".join(group))
  File "C:\Users\user\AppData\Roaming\Python\Python37\site-packages\rshell\main.py", line 1913, in onecmd_exec
    return cmd.Cmd.onecmd(self, line)
  File "c:\program files (x86)\microsoft visual studio\shared\python37_64\lib\cmd.py", line 217, in onecmd
    return func(arg)
  File "C:\Users\user\AppData\Roaming\Python\Python37\site-packages\rshell\main.py", line 2329, in do_cp
    if not cp(src_filename, dst_filename):
  File "C:\Users\user\AppData\Roaming\Python\Python37\site-packages\rshell\main.py", line 685, in cp
    filesize, xfer_func=send_file_to_remote)
  File "C:\Users\user\AppData\Roaming\Python\Python37\site-packages\rshell\main.py", line 1616, in remote
    output, _ = self.pyb.follow(timeout=20)
  File "C:\Users\user\AppData\Roaming\Python\Python37\site-packages\rshell\pyboard.py", line 218, in follow
    raise PyboardError('timeout waiting for first EOF reception')
rshell.pyboard.PyboardError: timeout waiting for first EOF reception
davehylands commented 3 years ago

I think I screwed up the 0.0.29 release. Can you try 0.0.30 instead?

Also, you shouldn't have to specify a buffer size. It should default to 128 (which is the default for the pico).

RyanGaudion commented 3 years ago

Hi @davehylands , thanks for the quick reply - just tried with v0.0.30 and it throws the same error:

C:\Users\user>rshell --v
0.0.30

C:\Users\user>rshell
Connecting to COM3 (buffer-size 128)...
Trying to connect to REPL  connected
Retrieving sysname ... rp2
Testing if sys.stdin.buffer exists ... Y
Retrieving root directories ...
Setting time ... Mar 02, 2021 13:33:55
Evaluating board_name ... pyboard
Retrieving time epoch ... Jan 01, 1970
Welcome to rshell. Use the exit command to exit rshell.
C:\Users\user> cd Desktop/
C:\Users\user/Desktop> cp main.py /pyboard/main.py
Copying 'C:\Users\user/Desktop/main.py' to '/pyboard/main.py' ...
Traceback (most recent call last):
  File "C:\Users\user\AppData\Roaming\Python\Python37\Scripts\rshell-script.py", line 11, in <module>
    load_entry_point('rshell==0.0.30', 'console_scripts', 'rshell')()
  File "C:\Users\user\AppData\Roaming\Python\Python37\site-packages\rshell\command_line.py", line 4, in main
    rshell.main.main()
  File "C:\Users\user\AppData\Roaming\Python\Python37\site-packages\rshell\main.py", line 3084, in main
    real_main()
  File "C:\Users\user\AppData\Roaming\Python\Python37\site-packages\rshell\main.py", line 3067, in real_main
    shell.cmdloop(cmd_line)
  File "C:\Users\user\AppData\Roaming\Python\Python37\site-packages\rshell\main.py", line 1872, in cmdloop
    cmd.Cmd.cmdloop(self)
  File "c:\program files (x86)\microsoft visual studio\shared\python37_64\lib\cmd.py", line 138, in cmdloop
    stop = self.onecmd(line)
  File "C:\Users\user\AppData\Roaming\Python\Python37\site-packages\rshell\main.py", line 1902, in onecmd
    self.onecmd_exec("".join(group))
  File "C:\Users\user\AppData\Roaming\Python\Python37\site-packages\rshell\main.py", line 1913, in onecmd_exec
    return cmd.Cmd.onecmd(self, line)
  File "c:\program files (x86)\microsoft visual studio\shared\python37_64\lib\cmd.py", line 217, in onecmd
    return func(arg)
  File "C:\Users\user\AppData\Roaming\Python\Python37\site-packages\rshell\main.py", line 2329, in do_cp
    if not cp(src_filename, dst_filename):
  File "C:\Users\user\AppData\Roaming\Python\Python37\site-packages\rshell\main.py", line 685, in cp
    filesize, xfer_func=send_file_to_remote)
  File "C:\Users\user\AppData\Roaming\Python\Python37\site-packages\rshell\main.py", line 1616, in remote
    output, _ = self.pyb.follow(timeout=20)
  File "C:\Users\user\AppData\Roaming\Python\Python37\site-packages\rshell\pyboard.py", line 218, in follow
    raise PyboardError('timeout waiting for first EOF reception')
rshell.pyboard.PyboardError: timeout waiting for first EOF reception
davehylands commented 3 years ago

So the fix that makes things work better for some people is this line here: https://github.com/dhylands/rshell/blob/e2820f679aa06d40c35dbd5c626a0402047e28f8/rshell/main.py#L1107

It shows as a comment, but the rshell code "uncomments" any lines that start with #rp2: when the board is a Pico. If you run with rshell -d then you should see that line as uncommented when copying a file.

You could try increasing/decreasing that timeout to see if it helps you.

If you clone the github repository:

git clone https://github.com/dhylands/rshell.git

You can run rshell from the local tree by using:

cd rshell
./r.py ...use whatever rshell options you want here...
RyanGaudion commented 3 years ago

@davehylands - thank you for your response and sorry for the long delay in getting back to you. Changing line 1107 to the below resolved the issue: #rp2: time.sleep_ms(50)

RyanGaudion commented 3 years ago

@davehylands - I've created a pull request (#154) for this - let me know if I have missed anything within the PR

davehylands commented 3 years ago

@RyanGaudion PR looks fine. I just need to find some time to make a new release.

ilan-schemoul commented 2 years ago

In my case increasing the buffer size saved me https://github.com/dhylands/rshell/pull/168

willbelr commented 2 years ago

In my case increasing the buffer size saved me #168

I got the same problem with the Pico. The delay did not help, but setting RPI_PICO_USB_BUFFER_SIZE to 256 did work

rshell 0.0.30-1, Arch Linux

$ rshell
Connecting to /dev/ttyACM0 (buffer-size 128)...
Trying to connect to REPL  connected
Retrieving sysname ... rp2
Testing if sys.stdin.buffer exists ... Y
Retrieving root directories ... /main.py/
Setting time ... Dec 16, 2021 15:33:40
Evaluating board_name ... pyboard
Retrieving time epoch ... Jan 01, 1970
Welcome to rshell. Use Control-D (or the exit command) to exit rshell.
/home/user> cp ~/scripts/macropad/main.upy /pyboard/main.py
Copying '/home/user/scripts/macropad/main.upy' to '/pyboard/main.py' ...
timed out or error in transfer to remote: b''
MasterYuan418 commented 1 year ago

Same as you, PyboardError('timeout waiting for first EOF reception') on 0.0.31, while coping an 256KB file to Pico. Windows 10

reunano commented 1 year ago

Im getting this error on a LEGO large hub : timed out or error in transfer to remote: b'' Will you be able to guide me on how to trouble shoot? Thank you!

willbelr commented 1 year ago

Im getting this error on a LEGO large hub : timed out or error in transfer to remote: b'' Will you be able to guide me on how to trouble shoot? Thank you!

Try using rshell --buffer-size 256

reunano commented 1 year ago

Thank you for trying to help. This did not solve the issue I still get: /remote/remote.mpy' to '/pyboard/spike/remote.mpy' ... timed out or error in transfer to remote: b''