Can't program TinyFPGA BX anymore [SOLVED]


#1

Was working with it in icestorm just fine for the past few days. Out of nowhere it stopped letting me program it.

Hitting reset or unplugging/replugging results in a flashing boot light as expected.

tinyprog -l

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

        COM7: No metadata

tinyprog --update-bootloader

    TinyProg CLI
    ------------
    Using device id 1d50:6130
    Only one board with active bootloader, using it.
    All connected and active boards are up to date!

Attempting to program via apio gives: “Error: board TinyFPGA-BX not connected”

Attempting to program with ice storm gives a similar inability to find the board.

I’ve tried different USB ports, drivers install and setup correctly each time, shows up in device manager as “USB Serial Device (COM7)”

compiling with apio and attempting to write using tinyprog gives:

    TinyProg CLI
    ------------
    Using device id 1d50:6130
    Only one board with active bootloader, using it.
    Programming COM7 with hardware.bin
Traceback (most recent call last):
  File "c:\python38\lib\runpy.py", line 193, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\python38\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Python38\Scripts\tinyprog.exe\__main__.py", line 9, in <module>
  File "c:\python38\lib\site-packages\tinyprog\__main__.py", line 334, in main
    addr = fpga.meta.userimage_addr_range()[0]
  File "c:\python38\lib\site-packages\tinyprog\__init__.py", line 182, in userimage_addr_range
    return self._get_addr_range(u"userimage")
  File "c:\python38\lib\site-packages\tinyprog\__init__.py", line 188, in _get_addr_range
    addr_str = self.root[u"bootmeta"][u"addrmap"][name]
TypeError: 'int' object is not subscriptable

Running “tinyprog -b” works correctly and causes my last programmed image to start up and fucntion correctly.

Any ideas? This issue does seem similar to TinyFPGA-BX Won't Program Anymore from 2 years ago, but I was hesitant to start hacking around with that.


#2

Alright, so I’ve fixed it. It turns out it was that the bootloader somehow disappeared from the flash memory.

Going to document what I did to fix it since every guide I found on the forums seemed not to work for me.

I used a TL866-II Plus programmer to re-flash the SPI Flash Memory on the board using the ISP port.

  • Solder wires to the bottom side exposed pads of the tinyfpga SCK, IO1, IO0, SS; 3v, G (I used the one next to the 3v connector, not the ones at the bottom of the board)
  • Plug in TL866-II Plus ISP adapter (the plug on the opposite end of the USB port)
  • Connect the pins as noted (left side is TL866-II Plus, right side is tinyfpga)
    • /CS -> SS
    • VCC (red wire) -> 3v
    • GND (black wire) -> G
    • MOSI -> IO0
    • MISO -> IO1 (optional, but recommended, also connect a 30pF capacitor between this and G)
    • CLK -> SCK
  • open Xgpro
  • select IC “AT25DF081” (the chip used is actually AT25SF081, but this is compatible)
  • unselect “Check ID” (we’re going to manually check the id, since we’re using a different IC than the one we’re selecting)
  • Press and hold Reset on TinyFPGA while you select “Read ID” from the “Device” menu (or press the read ID button on the toolbar)
  • In the text box on the right side, it should say: “Read Device ID: 1F 85 01” *** DO NOT CONTINUE IF THIS IS NOT DISPLAYED–double check your wiring ***
  • Select Device, Read, or press the Read button on the toolbar.
  • Press and hold Reset on the Tinyfpga, click “Read” in Xgpro, hold the reset button for the duration of the read until it says “Read finished!”, this should take around 5 seconds.
  • Click cancel, then save this as a backup.
  • Download the tinyfpga bootloader binary from here: https://github.com/tinyfpga/TinyFPGA-Bootloader/releases/ (BE SURE YOU GET tinyfpga_bx_fw.bin)
  • From Xgpro, Open tinyfpga_tx_fw.bin from wherever you saved it
    • set file format to binary
    • region to Default
    • load mode to normal
    • From file start Addr to 00000
    • To buffer start addr to 00000
    • Clear buffer with 0xFF (this is the only non-default setting, but it shouldn’t matter if you don’t change it)
  • Select “program” from “device” menu, or press the program button on the toolbar.
  • While pressing and holding the TinyFPGA reset button (DO NOT LET GO UNTIL PROGRAMMING FINISHES), click the “program button” This may take 15-30 seconds to finish.
  • unplug and try programming your device (it should be fixed)!

Important note press and hold the Reset button on the TinyFPGA for the entire duration that you are reading/verifying/etc!