A couple of weeks ago, I ordered the early adopter iCEBreaker bitsy FPGA board. It arrived promptly just a few days later!


Key details:
  • Use dfu-util to upload binary files to the Bitsy (see Windows binaries )
  • The board needs to be in DFU boot mode to upload FPGA bin file
  • Hold button down when powering on device to enter DFU boot mode
  • Click button while in DFU boot mode to exit boot mode
  • FPGA Toolchain needs to be installed.

Note that I am using WSL on Windows. All the FPGA synthesis stuff happens in WSL. However, there is no native USB support in my WSL 1, so I use the DOS executables (either from WSL or Windows DOS prompt) for the actual device programming. Although I have several blog entries that mention this topic, I have a summary for Programming FPGA Devices from WSL .
For open source toolchain, you can install everything from GitHub, or use Multi-platform nightly builds of open source FPGA tools. I also have a Visual Studio FPGA Extension that will soon build and upload from the comfort of the VS IDE. (currently, the release only does syntax highlighting)

Unlike the similarly named iCEBreaker, this board does NOT use iceprog  to upload binaries.
 
If when running dfu-util.exe -l, the device cannot be seen:


dfu-util 0.9
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

Make sure you are using a known good USB cable. Recall the button needs to be pressed before power is applied. There's apparently an issue with USB3.0 PowerShare ports. Try using a different port, or perhaps a USB hub .

 
If when running dfu-util.exe -l, the device cannot be opened:


Cannot open DFU device 1d50:6146
C:\Users\gojimmypi>C:\Download\dfu-util\dfu-util.exe -l
dfu-util 0.9
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
Cannot open DFU device 1d50:6146


This typically means the Windows drivers are not installed. Zadig to the rescue:


If for some reason Windows cannot load the drivers at all, try holding down the bitsy button while plugging in the USB cable.

If when running dfu-util.exe -l, the device is working properly:


dfu-util 0.9
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
Found DFU: [1d50:6146] ver=0004, devnum=12, cfg=1, intf=0, path="1-1.3", alt=1, name="RISC-V firmware", serial="your serial"
Found DFU: [1d50:6146] ver=0004, devnum=12, cfg=1, intf=0, path="1-1.3", alt=0, name="iCE40 bitstream", serial="your serial"
We can proceed to actually programming the FPGA.

From what I can tell, it seems the Bitsy is iCEBreaker compatible:

cd /mnt/c/workspace
git clone https://github.com/icebreaker-fpga/icebreaker-examples.git
cd icebreaker-examples/blink_count_shift
make

To program the Bitsy, as there are multiple, identical DFU numbers, the "alt" needs to be specified:


dfu-util.exe -a 0 -D blink_count_shift.bin

Beyond blinky, a pinout is useful:  (There may be variations depending on the specific board version)

iCEBreaker Bitsy Pinout by 0xdec

There's a main repo: https://github.com/icebreaker-fpga/icebreaker-examples but I learned on the discord channel that the code for the Bitsy has not yet been pushed there.

That repo will likely at some point have all the latest code. For now it is still in esden/icebreaker-examples

git clone https://github.com/esden/icebreaker-examples.git esden-icebreaker-examples
cd esden-icebreaker-examples
git branch --all
git checkout bitsy
cd blink_count_shift
make clean
make BOARD=bitsy1  
Note the `make` will be expecting parameters:


$ make
../board.mk:18: *** Please specify BOARD, options are "icebreaker", "bitsy0" or "bitsy1".  Stop.


then upload:

dfu-util.exe -a 0 -D C:\workspace\esden-icebreaker-examples\blink_count_shift\blink_count_shift.bin

Here we should be able to press the Bitsy button to get the green LED to illuminate.

Beyond blinky, I learned there's a DFU UART on FPGA pin 44 (aka IOB_4a, aka P2).

Hookup a USB Serial Port and at DFU boot time at 1000000 baud, a message is displayed:


Booting DFU image..
Flash Manufacturer : ef 40 18
Flash Unique ID    : e4 69 98 d2 43 59 15 2f
Command>  

I also learned on discord that USB signals-D/+D are actually 3.3V, even though the supply voltage is 5V
There's this interesting iua: ice40 USB Analyzer that is meant to run on an iCEBreaker FPGA that can apparently be used to "dump all the USB traffic". Note there's an minor problem building, but I have a PR to fix that. (thanks to @tnt on discord for the info). Basically just needed to add a magic parameter --placer sa to run nextpnr like this:


nextpnr-ice40 --placer sa  --up5k --package sg48 --json iua_icebreaker_top.json --pcf ../impl/iua_icebreaker_pins.pcf --asc iua_icebreaker_top.asc --freq 50  

This will happen during make.

Also from @tnt on discord:
There are debug pads on the bity bottom where you can easily solder a header.

set_io -nowarn usb_dp_pad 31
set_io -nowarn usb_dn_pad 34

 Those are the fpga pins where to connect on the icebreaker side.


To be continued in my next post... Sigrok on WSL for iua: ice40 USB Analyzer
 




Copyright (c) gojimmypi all rights reserved. Blogger Image Move Cleaned: 5/3/2021 1:35:54 PM