TinyFPGA-Bootloader icon indicating copy to clipboard operation
TinyFPGA-Bootloader copied to clipboard

Bootloader update bricked a new TinyFPGA BX

Open Wren6991 opened this issue 6 years ago • 1 comments

Hope this is the right repo for this issue. This is a brand new board I got from Digikey. I was following the instructions in the TinyFPGA BX User Guide. I'm running Ubuntu 18.10. Prior to this log I installed apio via pip3 install apio, installed serial udev rule via apio drivers --serial-enable, and installed tinyprog via pip3 install tinyprog

atlas:~δ lsusb
Bus 006 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 005 Device 003: ID 0bda:0811 Realtek Semiconductor Corp. 
Bus 005 Device 002: ID 04d9:a0cd Holtek Semiconductor, Inc. 
Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 036: ID 1209:2100 InterBiometrics 
Bus 001 Device 003: ID 062a:4102 Creative Labs 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
atlas:~δ 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: dbce8bd3-7702-4fd3-815b-2aabe7e0c942
            FPGA: ice40lp8k-cm81

    Would you like to perform the update? [y/N] y
    Fetching stage one...
    Programming stage one...
    Erasing: 100%|████████████████████████████████████████████████████████████████████████████████████████| 135k/135k [00:00<00:00, 157kB/s]
    Writing: 100%|███████████████████████████████████████████████████████████████████████████████████████| 135k/135k [00:01<00:00, 86.9kB/s]
    Reading: 100%|███████████████████████████████████████████████████████████████████████████████████████| 135k/135k [00:01<00:00, 86.5kB/s]
    ...Success!
    Waiting for stage one to reconnect....connected!
    Fetching stage two...
    Programming stage two...
    Erasing:   0%|                                                                                               | 0.00/299k [00:00<?, ?B/s]
Traceback (most recent call last):
  File "/home/luke/.local/lib/python3.6/site-packages/tinyprog/__init__.py", line 19, in to_int
    return ord(value)
TypeError: ord() expected a character, but string of length 0 found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/luke/.local/bin/tinyprog", line 11, in <module>
    sys.exit(main())
  File "/home/luke/.local/lib/python3.6/site-packages/tinyprog/__main__.py", line 314, in main
    perform_bootloader_update(port)
  File "/home/luke/.local/lib/python3.6/site-packages/tinyprog/__main__.py", line 184, in perform_bootloader_update
    if p.program_bitstream(0, bitstream):
  File "/home/luke/.local/lib/python3.6/site-packages/tinyprog/__init__.py", line 419, in program_bitstream
    return self.program(addr, bitstream)
  File "/home/luke/.local/lib/python3.6/site-packages/tinyprog/__init__.py", line 375, in program
    self.erase(addr, len(data), disable_progress=False)
  File "/home/luke/.local/lib/python3.6/site-packages/tinyprog/__init__.py", line 347, in erase
    self._erase(addr, erase_length)
  File "/home/luke/.local/lib/python3.6/site-packages/tinyprog/__init__.py", line 301, in _erase
    self.wait_while_busy()
  File "/home/luke/.local/lib/python3.6/site-packages/tinyprog/__init__.py", line 290, in wait_while_busy
    while to_int(self.read_sts()) & 1:
  File "/home/luke/.local/lib/python3.6/site-packages/tinyprog/__init__.py", line 21, in to_int
    return int(value)
ValueError: invalid literal for int() with base 10: b''
atlas:~δ tinyprog --update-bootloader

    TinyProg CLI
    ------------
    Using device id 1d50:6130
    No port was specified and no active bootloaders found.
    Activate bootloader by pressing the reset button.
atlas:~δ tinyprog --update-bootloader

    TinyProg CLI
    ------------
    Using device id 1d50:6130
    No port was specified and no active bootloaders found.
    Activate bootloader by pressing the reset button.
atlas:~δ lsusb
Bus 006 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 005 Device 003: ID 0bda:0811 Realtek Semiconductor Corp. 
Bus 005 Device 002: ID 04d9:a0cd Holtek Semiconductor, Inc. 
Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 062a:4102 Creative Labs 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
atlas:~δ echo Wat
Wat
atlas:~δ 

As shown in the log, the board no longer enumerates on USB, even when unplugged/replugged (performed in between the two "no active bootloaders found" messages). The heartbeat LED on the board is now illuminated at a constant, dim level, which is consistent with an unconfigured iCE40 with pins in default weak-pullup state.

I noticed that out of habit I used pip3 rather than pip to install the packages. Could this be the cause of this?

I also would quite like to rescue this board, so are there any flat binary images floating around I can use to reimage the SPI flash, including the iCE40 warmboot applet etc? I don't mind a bit of soldering.

Thanks! I am happy to add any more details, although further testing on my end will be a challenge :)

Wren6991 avatar Feb 28 '19 18:02 Wren6991

@Wren6991 I happened to spot both this issue, and some relevant discussion on the TinyFPGA discourse, while looking for something else, and wondered if you knew about this thread:

https://discourse.tinyfpga.com/t/error-while-updating-bootloader-invalid-literal-for-int-with-base-10/484/3

which seems to contain a link to firmware that could be programmed directly into the SPI if you knew how to solder onto the SPI pins, and run a SPI programmer (there's some hints in that post for where those pins are).

The details at https://github.com/tinyfpga/TinyFPGA-Bootloader/issues/18 seem pretty similar to your results (which was also the same person as that Discourse thread above).

Ewen

ewenmcneill avatar May 17 '19 08:05 ewenmcneill