BX board received, BX bootloader wiped! [Solved]


#1

Hi, I attempted to do an --update-bootloader on my shiny new BX board and I trashed the bootloader. I am running on macOS Mojave.

It stopped writing at 32% into stage two with a usb.core.USBError: [Errno 32] Pipe error and now the slow Blinky light doesn’t blink.

I have a 3.3V Arduino and can follow the instructions and here but I am not sure where to obtain the correct bootloader and what the memory map of the flash memory should look like.

Nice board BTW.
Derek


#2

Hi @SpaceCoaster! You can find the bootloader here: https://github.com/tinyfpga/TinyFPGA-Bootloader/releases/download/1.0.1/tinyfpga_bx_fw.bin


#3

There is some information on what the start of the flash memory should look like in this thread:


#4

@lukevalenty I think I need a bit of a hand with this!

I have tried to read the flash using an FT4232 board and flashrom. The version of Flashrom that I use has support for the AT25SF081 chip. I am unable to read the flash chip. Do you have a tutorial about how to rewrite the flash? I have a heap of suitable hardware (Arduino, Pi, Teensy, FTDI etc.).

Cheers,
Derek


#5

What’s your setup with the FTDI chip? Can you post a photo of the connections between the FTDI and the BX?

What kind of errors are you getting when you try to read back the flash?


#6

Hi Luke,

I am using these pins on the FT4232.

and I am connecting them as follows

FTDI SCLK connects to TinyFPGA pad 11, labelled SCK and connects to the flash SCK - Orange wire in photo

FTDI DO/MOSI, an output, connects to TinyFPGA pad 13, labelled SDO in schematic, IO0 on board and connects to the flash SI, an input - Yellow wire in photo

FTDI DI/MISO, an input, connects to TinyFPGA pad 12, labelled SDI in schematic, IO1 on board and connects to the flash SO, an output - Blue wire in photo

FTDI CS connects to TinyFPGA pad 14, labelled SS and connects to the flash !CS - Green wire in photo

EDIT: iceprog uses ADBUS4 as CS and needs the reset button held down while programming. This fixed the issue!

Here is a photo of the connections.

and a closeup of the board

I tried using flashrom to program it and it never found a chip. I switched to using iceprog from icestorm and it returns the following.

$ iceprog -d i:0x0403:0x6011 -t
init…
cdone: high
reset…
cdone: high
flash ID: 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF
cdone: high
Bye.

Cheers,
Derek


#7

Excellent pictures and information, thank you!

Try holding down the reset button while you access the SPI flash over the FTDI. The FPGA itself may be interfering with your communication…holding it in reset forces the FPGA to keep all of its IOs in tristate so it doesn’t attempt to drive any of the signals.


#8

EDIT: Our comms overlapped.

OK, fixed it. Shall I do the really annoying thing and just vanish or shall I share my failure…and SUCCESS!

I needed to connect CS to ADBUS4 on the FTDI. Iceprog toggles CS manually and is not using the FTDI MPSSE CS.

I also needed to hold down the reset button when programming. I guess this locks out the ICE40 from messing with the SPI flash interface.

Iceprog can also use ADBUS7 on the FTDI to control reset, would it be a good idea for me to do this?

The board is blinking and looks good. I will wire it up better and post a picture.

Thanks for the help.

Derek


#9

Yay! I’m glad you were able to figure it out and share your problems and solutions. Thank you so much for the great documentation!


#10

Almost finished with the updates.

Adafruit have a tutorial for their FT232 board to program an SPI flash. They use an adapted version of iceprog from IceStorm. It also uses ADBUS4 to drive CS. One additional wrinkle is they use a 5V to 3.3V LDO to power the flash.