Error while updating bootloader: invalid literal for int() with base 10



I just took my TinyFPGA BX out of the packaging, and tried to update the bootloader. It failed at this point:

    Programming stage two...
    Erasing:   0%|                                                                                                   | 0.00/299k [00:00<?, ?B/s]
Traceback (most recent call last):
  File "/home/joel/.local/bin/tinyprog", line 11, in <module>
    load_entry_point('tinyprog==1.0.18', 'console_scripts', 'tinyprog')()
  File "build/bdist.linux-x86_64/egg/tinyprog/", line 282, in main
  File "build/bdist.linux-x86_64/egg/tinyprog/", line 152, in perform_bootloader_update
  File "build/bdist.linux-x86_64/egg/tinyprog/", line 419, in program_bitstream
  File "build/bdist.linux-x86_64/egg/tinyprog/", line 375, in program
  File "build/bdist.linux-x86_64/egg/tinyprog/", line 347, in erase
  File "build/bdist.linux-x86_64/egg/tinyprog/", line 301, in _erase
  File "build/bdist.linux-x86_64/egg/tinyprog/", line 290, in wait_while_busy
  File "build/bdist.linux-x86_64/egg/tinyprog/", line 21, in to_int
ValueError: invalid literal for int() with base 10: ''

The full log is here:

When I connect to it now, it says this, even when I press the button:


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

I couldn’t work out what is contained in each stage of the bootloader. I assume I’m missing some important bits without the second stage.


Hey @shenki, this one is a bummer. If you have a JTAG Programmer, you can get the bootloader back on the board. If you don’t have a JTAG Programmer then we can exchange boards. I’ll send you one with the bootloader and you can send me back the one you have.

Stage two is the one that actually loads the new bootloader. If it fails at erase, that’s trouble. I’ll be working out a way to prevent it from failing this way in the future.

[BX] Error: 'device reports readiness to read but returned no data' [SOLVED]

If you do have a JTAG/SPI programmer, you can program the firmware image found here:

The SPI pins can be found on the bottom of the board and are labeled SS, SCK, IO0, and IO1. You’ll also want to connect the 3.3v to the VCC pin of your programmer so it uses 3.3v, and GND between the programmer and board.



It looks like I just fell victim to this. My log is identical, it fails on stage 2 and now I can’t connect to my TinyFPGA BX at all. I don’t have a JTAG programmer. What programmer is recommended that is cheap?


It looks like you can use an Arduino (but I haven’t tried this):
my preference is the “Blue Pill” stm32 boards:
(because they are cheap)
with this firmware:
and UrJTAG
which also supports lots of other adapters (aka “cable”):
List of supported cables:
ARCOM Arcom JTAG Cable
ByteBlaster Altera ByteBlaster/ByteBlaster II/ByteBlasterMV Parallel Port Download Cable
DLC5 Xilinx DLC5 JTAG Parallel Cable III
EA253 ETC EA253 JTAG Cable
EI012 ETC EI012 JTAG Cable
FT2232 Generic FTDI FT2232 Cable
ARM-USB-OCD Olimex ARM-USB-OCD[-TINY] (FT2232) Cable
Flyswatter TinCanTools Flyswatter (FT2232) Cable
gnICE Analog Devices Blackfin gnICE (FT2232) Cable (EXPERIMENTAL)
gnICE+ Analog Devices Blackfin gnICE+ (FT2232H) Cable (EXPERIMENTAL)
JTAGkey Amontec JTAGkey (FT2232) Cable
JTAGv3 XDS100 compatible JTAG/serial (FT2232) Cable
JTAGv5 XDS100v2 compatible JTAG/serial (FT2232H) Cable
KT-LINK KrisTech KT-LINK (FT2232H based) Cable
milkymist Milkymist JTAG/serial (FT2232) Cable
OOCDLink-s OOCDLink-s (FT2232) Cable (EXPERIMENTAL)
Signalyzer Xverve DT-USB-ST Signalyzer Tool (FT2232) Cable (EXPERIMENTAL)
Turtelizer2 Turtelizer 2 Rev. B (FT2232) Cable (EXPERIMENTAL)
usbScarab2 KrisTech usbScarabeus2 (FT2232) Cable
USB-to-JTAG-IF USB to JTAG Interface (FT2232) Cable (EXPERIMENTAL)
DigilentHS1 Digilent HS1 Adapter
FT4232 Generic FTDI FT4232 Cable
gpio GPIO JTAG Chain
ICE-100B Analog Devices ICE-X Cable (0x064B)
IGLOO Excelpoint IGLOO JTAG Cable
jlink Segger/IAR J-Link, Atmel SAM-ICE and others.
KeithKoep Keith & Koep JTAG cable
Lattice Lattice Parallel Port JTAG Cable
Minimal Minimal Parallel Port JTAG Cable
MPCBDM Mpcbdm JTAG cable
TRITON Ka-Ro TRITON Starterkit II (PXA255/250) JTAG Cable
UsbBlaster Altera USB-Blaster Cable
vsllink Versaloon Link –
WIGGLER Macraigor Wiggler JTAG Cable
WIGGLER2 Modified (with CPU Reset) WIGGLER JTAG Cable
xpc_ext Xilinx Platform Cable USB external chain
xpc_int Xilinx Platform Cable USB internal chain
DirtyJTAG DirtyJTAG STM32-based cable

FT2232H based-adapters are interesting (but not so cheap) because you can have a JTAG adapter and a usb serial port on the same “dongle”. And they’re faster than the Blue Pills when programming FPGA’s too.


I don’t understand what you are suggesting here. I don’t believe any of these methods work for the BX as is has no JTAG connections. You have to program it by writing to the flash memory using SPI. If I am wrong about this, please let me know what you would connect a JTAG programmer to.

What I believe @lukevalenty is referring to is a JTAG/SPI programmer and for the BX, you would need to use its SPI not its JTAG capability. Again, if I am wrong, please let me know. There are several people needing to reprogram their BXs, and it would be good to get a list of the available methods.


Yeah, I was a bit quick there, wasn’t I? Sorry about that.

Well, the FT2232 can do SPI, Arduino can do SPI (but I have only done that other other Atmel chips, not FPGAs)
and the Blue Pill can do SPI too. Again, I haven’t tried this with the TinyFPGA’s.

and you can use a Raspberry Pi


I have written about the methods that I think will work for the BX in this thread - BX bootloader bricked

Please add to that if you know of any other methods or spot any mistakes in what I have written. I don’t think that the Raspberry Pi method you linked to will work for the BX as it does not have the pins to drive the FPGA in SPI slave mode. I used a method similar to that on the Blackice icestorm device which is set up to be programmed like that. I think you would need a different Raspberry Pi program for the BX, which wrote to the SPI flash. Such a utility would not be hard to write but I haven’t seen one.