[Solved] rshell timed out or error in transfer to remote: b'F'

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
davef
Posts: 811
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

[Solved] rshell timed out or error in transfer to remote: b'F'

Post by davef » Mon Feb 22, 2021 7:09 am

Found a few threads which suggest that this error message is generated by rshell, I first noticed it when I built v1.14 source for the ESP8266 and tried to flash it.

Code: Select all

cp /home/dave/ESP-07S_Datalogger_project/boot.py /pyboard/
Executing "cp /home/dave/ESP-07S_Datalogger_project/boot.py /pyboard/"
----- About to send 458 bytes of code to the pyboard -----
def get_mode(filename):
    """Returns the mode of a file, which can be used to determine if a file
       exists, if a file is a file or a directory.
    """
    import os
    try:
        # Since this function runs remotely, it can't depend on other functions,
        # so we can't call stat_mode.
        return os.stat(filename)[0]
    except OSError:
        return 0
output = get_mode('/')
if output is None:
    print("None")
else:
    print(output)

-----

-----
----- About to send 2257 bytes of code to the pyboard -----
def recv_file_from_host(src_file, dst_filename, filesize, dst_mode='wb'):
    """Function which runs on the pyboard. Matches up with send_file_to_remote."""
    import sys
    import ubinascii
    import os
    if False:
        try:
            import pyb
            usb = pyb.USB_VCP()
        except:
            try:
                import machine
                usb = machine.USB_VCP()
            except:
                usb = None
        if usb and usb.isconnected():
            # We don't want 0x03 bytes in the data to be interpreted as a Control-C
            # This gets reset each time the REPL runs a line, so we don't need to
            # worry about resetting it ourselves
            usb.setinterrupt(-1)
    try:
        with open(dst_filename, dst_mode) as dst_file:
            bytes_remaining = filesize
            if not False:
                bytes_remaining *= 2  # hexlify makes each byte into 2
            buf_size = 30
            write_buf = bytearray(buf_size)
            read_buf = bytearray(buf_size)
            while bytes_remaining > 0:
                # Send back an ack as a form of flow control
                sys.stdout.write('\x06')
                read_size = min(bytes_remaining, buf_size)
                buf_remaining = read_size
                buf_index = 0
                while buf_remaining > 0:
                    if False:
                        bytes_read = sys.stdin.buffer.readinto(read_buf, read_size)
                    else:
                        bytes_read = sys.stdin.readinto(read_buf, read_size)
                    if bytes_read > 0:
                        write_buf[buf_index:bytes_read] = read_buf[0:bytes_read]
                        buf_index += bytes_read
                        buf_remaining -= bytes_read
                if False:
                    dst_file.write(write_buf[0:read_size])
                else:
                    dst_file.write(ubinascii.unhexlify(write_buf[0:read_size]))
                if hasattr(os, 'sync'):
                    os.sync()
                bytes_remaining -= read_size
        return True
    except:
        return False
output = recv_file_from_host(None, '/boot.py', 145)
if output is None:
    print("None")
else:
    print(output)

-----
timed out or error in transfer to remote: b'F'

Code: Select all

-----Response-----
b'16384\r\n'
don't know what this refers to, but this seems relevant

Code: Select all

output = recv_file_from_host(None, '/boot.py', 145)
I am guessing None should be something else.

Any suggestions?
Last edited by davef on Wed Apr 21, 2021 9:48 am, edited 1 time in total.

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

Re: rshell timed out or error in transfer to remote: b'F'

Post by davef » Tue Feb 23, 2021 7:56 pm

Found another way to try and get the .bin file on to the ESP8266:

Code: Select all

make PORT=/dev/ttyUSB0 deploy
but come up with this error:

Code: Select all

Writing build-GENERIC/firmware-combined.bin to the board
esptool.py v1.2
Connecting...

A fatal error occurred: Failed to connect to ESP8266
Makefile:199: recipe for target 'deploy' failed
make: *** [deploy] Error 2
And in the Makefile:

Code: Select all

deploy: $(BUILD)/firmware-combined.bin
        $(ECHO) "Writing $< to the board"   (line 199)
        $(Q)esptool.py --port $(PORT) --baud $(BAUD) write_flash$

Appreciate any help getting firmware-combined.bin on to the ESP8266.

Thanks,

robm2470
Posts: 1
Joined: Mon Mar 29, 2021 11:33 am

Re: rshell timed out or error in transfer to remote: b'F'

Post by robm2470 » Mon Mar 29, 2021 11:48 am

Sometimes this is to do with the target board and not rshell. I have a standard NodeMCU and copying files is fine with no timeouts. Try the same thing with a NodeMCU Kit 8 variant, which has the build-in oled display, and it baulks with a b'F' timeout. Same computer, same version of rshell, works on one but not the other.

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

Re: rshell timed out or error in transfer to remote: b'F'

Post by davef » Mon Mar 29, 2021 6:32 pm

Even when flashing the official v1.14.bin I have seen this maybe 1 or 2 times out of a hundred. I got things working without having to modify the firmware, so ... problem gone away.

Thanks for the comment

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

Re: rshell timed out or error in transfer to remote: b'F'

Post by davef » Wed Apr 21, 2021 1:48 am

Reading through some old threads firmware-combined.bin is supposed to be smaller than the official image.

esp8266-1m-20210418-v1.15.bin is 589,092
(my) firmware-combined.bin is 838,116.

The build proceeds without warnings or errors, but should it really be smaller?

Thanks,
Dave

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: rshell timed out or error in transfer to remote: b'F'

Post by Roberthh » Wed Apr 21, 2021 8:23 am

Depends which build you made and if you comparing the right ones. The pre-built one you cite is the build for 1MByte devices, which excludes quite a few modules. If you made a full build for 2MB+ devices, then it may be larger.
P.S.: If I build just now, I get 611904 bytes. So your size is indeed pretty large.

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

Re: rshell timed out or error in transfer to remote: b'F'

Post by davef » Wed Apr 21, 2021 9:43 am

Thank you so much for saying:
Depends which build you made
It has been 6+ months since I was building stuff for the Black Pill and I had clean forgot about specifying that on the command line :(

When I;

Code: Select all

make BOARD=GENERIC_1M
I get a firmware-combined.bin of 509,788. The micropython source was downloaded a few months ago.

Well, it works properly now I can try Peter Hinch's fix for ntptime. That is two issues that has been bothering me for the last 6 months sorted today.

Thanks again,
Dave

Post Reply