Programming the TinyFPGA-BX with the HW-USBN-2B Cable


#1

Hi,

I’m trying to program the TinyFPGA-BX with the HW-USBN-2B Programming cable from Lattice, using the Diamond Programmer software.
The connections between the cable and the TinyFPGA-BX are as follows:

HW-USBN-2B | TinyFPGA-BX
TCK/SCLK | G7 - SPI Flash Clock
TDI/SDI | G6 - SPI Flash MOSI/IO0
TDO/SDO | H7 - SPI Flash MISO/IO1
ISPEN/PROG | F8 - SPI Flash CS_B
TRST | RST
VCC | 3.3V
5V Out | Vin

Unfortunately, the Flash memory of the TinyFPGA-BX, the Adesto AT25SF081, is not listed on the available memories of the Diamond Programmer. However, running the “Scan SPI Device”, there are a few memories that seem to be compatible:

SPI Flash Device #1 :
Vendor:Numonyx
Name:SPI-M25P80
Device ID:0x13
Size:8 Mbits
Family:SPI Serial Flash

SPI Flash Device #2 :
Vendor:Micron
Name:SPI-M25P80
Device ID:0x13
Size:8 Mbits
Family:SPI Serial Flash

SPI Flash Device #3 :
Vendor:STMicro
Name:SPI-M25P80
Device ID:0x13
Size:8 Mbits
Family:SPI Serial Flash

SPI Flash Device #4 :
Vendor:ATMEL
Name:AT25SF081
Device ID:0x85
Size:8 Mbits
Family:SPI Serial Flash Custom

If I select any of these memories the programmer seems to run successfully. However, the FPGA doesn’t seem to have the correct firmware loaded.
I’m just trying to put back the bootloader that I got from https://github.com/tinyfpga/TinyFPGA-Bootloader/releases/download/1.0.1/tinyfpga_bx_fw.bin
After programming the FPGA, the LED does not blink as expected, even after pressing the reset button, not even for 1s. (I tried also powering with the USB cable).
I don’t know if I should write the bootloader to a specific address, (I saw an entry from Lawrie mentioning that the bootloader is at 0xA0), but that address is not on the available ones. Only 0x0,0x10000, 0x20000…

Can someone help me?


#2

I have not used the Lattice Diamond software.

The file you are trying to flash is a multiboot configuration with some control information in the first 160 bytes, a copy of the bootloader at address 0xa0 and second copy at address 0x28000. It should be the right file, but I don’t know if you need to specifically use the multi-boot option in the Diamond software. The start address of zero is correct. The end address looks wrong. It should be closer to 0x50000. But that might not be a problem as the second copy of the bootloader is not important and gets overwritten by the user configuration.

The release directory also includes just the bootloader itself in bootloader,bin. You could try flashing that at address 0 to see if your problem is because you are flashing a multiboot configuration. The bootloader.bin file ought to flash and run and blink the led, but won’t work as a bootloader as you need a multiboot configuration that supports SB_WARMBOOT for that. It should support commands other than -p.

Lattice might call it warm boot rather than multiboot.


#3

Thank you very much for your help Lawrie!
In reality, the programming of the SPI Flash memory was working fine.
However, the iCE40 wasn’t working properly with the cables of the Lattice programmer connected.
After disconnecting the cables, the TinyFPGA started to run correctly.