[NUCLEO-F446RE] rshell --> timed out or error in transfer to remote

Discussion and questions about boards that can run MicroPython but don't have a dedicated forum.
Target audience: Everyone interested in running MicroPython on other hardware.
Post Reply
lukesky333
Posts: 44
Joined: Fri Sep 02, 2016 4:07 pm
Location: Austria

[NUCLEO-F446RE] rshell --> timed out or error in transfer to remote

Post by lukesky333 » Fri Jun 14, 2019 10:49 am

Hi,

I'm trying to copy the uasyncio library to my NUCLEO-F446RE board (MB1136 C-03). I tried to copy the whole folder, I tried to copy single files -everytime I get the error message:

Code: Select all

$ rshell -b 115200 -p /dev/ttyACM0 cp -r lib /flash
Using buffer-size of 32
Connecting to /dev/ttyACM0 (buffer-size 32)...
Trying to connect to REPL  connected
Testing if ubinascii.unhexlify exists ... Y
Retrieving root directories ... /flash/
Setting time ... Jun 14, 2019 12:45:44
Evaluating board_name ... pyboard
Retrieving time epoch ... Jan 01, 2000
timed out or error in transfer to remote
It seems that all files are only partialy copied:

Code: Select all

$ rshell -b 115200 -p /dev/ttyACM0 ls -l /flash/lib/uasyncio
Using buffer-size of 32
Connecting to /dev/ttyACM0 (buffer-size 32)...
Trying to connect to REPL  connected
Testing if ubinascii.unhexlify exists ... Y
Retrieving root directories ... /flash/
Setting time ... Jun 14, 2019 12:41:50
Evaluating board_name ... pyboard
Retrieving time epoch ... Jan 01, 2000
   675 Jun 14 12:09 __init__.py
   912 Jun 14 12:39 core.py
   915 Jun 14 12:17 queues.py
   846 Jun 14 11:45 synchro.py
Any idea what I can do?

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

Re: [NUCLEO-F446RE] rshell --> timed out or error in transfer to remote

Post by dhylands » Fri Jun 14, 2019 4:50 pm

I ran into this on the F401 as well (when transferring over UART), and I haven't spent the time to figure out what the underlying problem is.

I suspect that characters are being dropped on the UART connection. I'll see if I can look into this next week. This used to work, but it might have something to do with interference between the UART and writing the files to flash.

On the F401 I wound up making the files be frozen files.

Something to try in the meantime would be to write a script which takes the file to be copied and generates another python program which prints the output to a file. Then you could use pyboard.py to copy the file. This should work for files which can fit in the available RAM.

lukesky333
Posts: 44
Joined: Fri Sep 02, 2016 4:07 pm
Location: Austria

Re: [NUCLEO-F446RE] rshell --> timed out or error in transfer to remote

Post by lukesky333 » Mon Jun 17, 2019 11:57 am

dhylands wrote:
Fri Jun 14, 2019 4:50 pm
I ran into this on the F401 as well (when transferring over UART), and I haven't spent the time to figure out what the underlying problem is.

I suspect that characters are being dropped on the UART connection. I'll see if I can look into this next week. This used to work, but it might have something to do with interference between the UART and writing the files to flash.
Thanks a lot for having a look into this issue.
dhylands wrote:
Fri Jun 14, 2019 4:50 pm
On the F401 I wound up making the files be frozen files.

Something to try in the meantime would be to write a script which takes the file to be copied and generates another python program which prints the output to a file. Then you could use pyboard.py to copy the file. This should work for files which can fit in the available RAM.
I don't understand, what you mean with this?

In between I'll try the Micropython-Editor. I've compiled the editor as module in Micropython and it seems to work...

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: [NUCLEO-F446RE] rshell --> timed out or error in transfer to remote

Post by jimmo » Mon Jun 17, 2019 12:24 pm

lukesky333 wrote:
Mon Jun 17, 2019 11:57 am
I don't understand, what you mean with this?
"On the F401 I wound up making the files be frozen files." --> I assume this means put uasyncio.py etc into the firmware image (by putting it into ports/stm32/modules or ports/stm32/boards/BOARD/modules depending on your config). This way you don't have to worry about syncing it to your filesystem.

"Something to try in the meantime would be to write a script which takes the file to be copied and generates another python program which prints the output to a file. Then you could use pyboard.py to copy the file. This should work for files which can fit in the available RAM." --> pyboard.py never writes to flash, it just copies your code text into RAM and executes it. So dhyland's suggestion would result in the copying of the file over UART not happening at the same time as writing the flash. (i.e. the program would be copied to ram, then it would run and write out

So the script would generate something like this for a file named 'filename.py'

Code: Select all

code = """
actual contents of filename.py, some escaping left as exercise to the reader
"""
with open('filename.py', 'w'):
  f.write(code)
In a sense, using MicroPython-Editor would achieve the same thing as it holds the file in RAM then separately writes to flash.

lukesky333
Posts: 44
Joined: Fri Sep 02, 2016 4:07 pm
Location: Austria

Re: [NUCLEO-F446RE] rshell --> timed out or error in transfer to remote

Post by lukesky333 » Mon Jun 17, 2019 1:48 pm

jimmo wrote:
Mon Jun 17, 2019 12:24 pm
...
"On the F401 I wound up making the files be frozen files." --> I assume this means put uasyncio.py etc into the firmware image (by putting it into ports/stm32/modules or ports/stm32/boards/BOARD/modules depending on your config). This way you don't have to worry about syncing it to your filesystem.
That's it I've done - uasyncio as module is allready working...
jimmo wrote:
Mon Jun 17, 2019 12:24 pm
...

Code: Select all

code = """
actual contents of filename.py, some escaping left as exercise to the reader
"""
with open('filename.py', 'w'):
  f.write(code)
In a sense, using MicroPython-Editor would achieve the same thing as it holds the file in RAM then separately writes to flash.
Ahh OK - I understand. ...thanks a lot!!!

FYI: the "as f" was missing...

Code: Select all

...
with open('filename.py', 'w') as f:
...

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

Re: [NUCLEO-F446RE] rshell --> timed out or error in transfer to remote

Post by dhylands » Wed Jun 19, 2019 4:12 am

It looks like the problem was interference between writing to flash and the UART. If I commented out the file writes then the file would be transferred successfully (but not writeen to flash.

So I added a call to os.sync and that seems to allow things to work properly. I was able to copy a 17K file to my NUCLEO_F446RE board. So please try upgrading to rshell 0.0.26

lukesky333
Posts: 44
Joined: Fri Sep 02, 2016 4:07 pm
Location: Austria

Re: [NUCLEO-F446RE] rshell --> timed out or error in transfer to remote

Post by lukesky333 » Tue Jun 25, 2019 12:16 pm

dhylands wrote:
Wed Jun 19, 2019 4:12 am
...
So I added a call to os.sync and that seems to allow things to work properly. I was able to copy a 17K file to my NUCLEO_F446RE board. So please try upgrading to rshell 0.0.26
Yes, with rshell 0.0.26 the problem is fixed. THANKS!!!

User avatar
Ventran
Posts: 24
Joined: Sun Jun 21, 2020 4:28 pm
Location: Poland, Europe

Re: [NUCLEO-F446RE] rshell --> timed out or error in transfer to remote

Post by Ventran » Thu Oct 01, 2020 7:48 am

I had the same problem with NUCLEO-F401RE Board and uPyCraft v1.1 Tool. Copy only ~3.5k code file *.py
RShell v0.0.28 Tool work perfect. Thank You.

Post Reply