tinyfpga / TinyFPGA-Bootloader

An open source USB bootloader for FPGAs
Apache License 2.0
357 stars 94 forks source link

Write fails while uploading bootloader #64

Open cpitclaudel opened 4 years ago

cpitclaudel commented 4 years ago

Here is the complete interaction, using an out-of-the-box TinyFPGA:

$ tinyprog --update-bootloader

    TinyProg CLI
    ------------
    Using device id 1d50:6130
    Only one board with active bootloader, using it.

    The following update:

        New Version: 1.0.1
        Notes: Updates USB VID:PID to fix issues with APIO not recognizing the board.

    is available for this board:

        /dev/ttyACM0: TinyFPGA BX 1.0.0
            UUID: b79d8bba-4ebb-499e-8d28-300ea942f89b
            FPGA: ice40lp8k-cm81

    Would you like to perform the update? [y/N] y
    Fetching stage one...
    Programming stage one...
Traceback (most recent call last):
  File "/home/user/.local/lib/python3.6/site-packages/serial/serialposix.py", line 537, in write
    n = os.write(self.fd, d)
OSError: [Errno 5] Input/output error

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/user/.local/bin/tinyprog", line 11, in <module>
    sys.exit(main())
  File "/home/user/.local/lib/python3.6/site-packages/tinyprog/__main__.py", line 314, in main
    perform_bootloader_update(port)
  File "/home/user/.local/lib/python3.6/site-packages/tinyprog/__main__.py", line 150, in perform_bootloader_update
    if p.program_bitstream(userimage_addr, bitstream):
  File "/home/user/.local/lib/python3.6/site-packages/tinyprog/__init__.py", line 417, in program_bitstream
    self.wake()
  File "/home/user/.local/lib/python3.6/site-packages/tinyprog/__init__.py", line 250, in wake
    self.cmd(0xab)
  File "/home/user/.local/lib/python3.6/site-packages/tinyprog/__init__.py", line 242, in cmd
    self.ser.write(bytearray(cmd_write_string))
  File "/home/user/.local/lib/python3.6/site-packages/tinyprog/__init__.py", line 66, in write
    self.ser.write(data)
  File "/home/user/.local/lib/python3.6/site-packages/serial/serialposix.py", line 571, in write
    raise SerialException('write failed: {}'.format(e))
serial.serialutil.SerialException: write failed: [Errno 5] Input/output error

Trying again:

$ tinyprog --update-bootloader

    TinyProg CLI
    ------------
    Using device id 1d50:6130
    Only one board with active bootloader, using it.
Traceback (most recent call last):
  File "/home/user/.local/lib/python3.6/site-packages/serial/serialposix.py", line 265, in open
    self.fd = os.open(self.portstr, os.O_RDWR | os.O_NOCTTY | os.O_NONBLOCK)
OSError: [Errno 16] Device or resource busy: '/dev/ttyACM0'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/user/.local/bin/tinyprog", line 11, in <module>
    sys.exit(main())
  File "/home/user/.local/lib/python3.6/site-packages/tinyprog/__main__.py", line 306, in main
    check_for_wrong_tinyfpga_bx_vidpid() +
  File "/home/user/.local/lib/python3.6/site-packages/tinyprog/__main__.py", line 88, in check_for_wrong_tinyfpga_bx_vidpid
    with port:
  File "/home/user/.local/lib/python3.6/site-packages/tinyprog/__init__.py", line 60, in __enter__
    self.ser = serial.Serial(self.port_name, timeout=1.0, writeTimeout=1.0).__enter__()
  File "/home/user/.local/lib/python3.6/site-packages/serial/serialutil.py", line 240, in __init__
    self.open()
  File "/home/user/.local/lib/python3.6/site-packages/serial/serialposix.py", line 268, in open
    raise SerialException(msg.errno, "could not open port {}: {}".format(self._port, msg))
serial.serialutil.SerialException: [Errno 16] could not open port /dev/ttyACM0: [Errno 16] Device or resource busy: '/dev/ttyACM0'