(WSL) Can't find iCE FTDI USB device

Hi,

Just got my iCEBreaker board and wanted to test it, sadly for me my linux box got broken so i gave WSL a try, i have installed all the requirements (icestorm, yosys, nextpnr for ice40).
After adding the file /etc/udev/rules.d/53-lattice-ftdi.rules with the following content:

ATTRS{idVendor}==“0403”, ATTRS{idProduct}==“6010”, MODE=“0660”, GROUP=“plugdev”, TAG+=“uaccess”

I got the famous error:

init…
Can’t find iCE FTDI USB device (vendor_id 0x0403, device_id 0x6010 or 0x6014).
ABORT.

I will try to solve it this weekend, just wanted to ask if somebody is already using the iCEBreaker board on WSL…

-Carlos

1 Like

Hi @Carlos_Diaz welcome to the forum.

I am glad you received your iCEBreaker.

As far as I know programming is not possible using WSL. Microsoft still does not have libusb support that would be necessary here. Make your voices heard and they might finally implement it correctly. :slight_smile:

Everything else should work though and you should be able to use the lattice radiant programmer to upload the resulting bitstreams.

I have written a really quick config guide in the wiki.

Considering how slow the radiant programmer can be, it would indeed be nice to have a iceprog version that uses winusb instead of libusb. That might be a way forward until WSL gets proper USB device support. :slight_smile:

Cheers,
Piotr

1 Like

Thanks for the reply @esden, just upvoted the request for libusb support on WSL.

I will take a look at the radiant programmer setup, if i understand correctly i should be able to access the generated bitstreams from the WSL on the Windows file system and use radiant from there…, that should work since I am doing pretty basic stuff.

Having a winusb based iceprog would be a nice challenge to solve :slight_smile:

Regards,
Carlos

Yes you are correct. You would run Radiant programmer on Windows and access the binaries created in WSL.

There is also another way of doing things. APIO comes with the full toolchain and contains iceprog as far as I know. So you can write your hdl in the apio-ide. That also means you would have to recreate the example projects that use gnu make in apio, as apio forces you to use scons as far as I know. Or you can call the iceprog binary directly. I bet there are multiple ways of solving the programming under windows situation. :slight_smile:

Let us know what you come up with. :slight_smile:

I was able to get the FPGAwars Windows build of iceprog working. As a bonus WSL allows you to run a windows EXE from its bash prompt so with some minor modifications you can run it all from within bash.

The only catch is that you need to change the USB drivers to libusbK. Icestudio handles this pretty nicely, but really it has just bundled this tool called Zadig: https://zadig.akeo.ie/

  1. If you haven’t already, plug in your iCEBreaker and let windows install the default drivers
  2. Download and run Zadig
  3. On the “Options” menu select “List All Devices”
  4. Find your iCEBreaker Interface 0 and select it in the combo box (mine appears as “iCEBreaker V1.0e (Interface 0)”)
  5. The left-hand side will list the current driver installed for the device. On the right-hand side change it to libusbK.
  6. Click “Replace Driver” and wait
  7. Repeat steps 4,5,6 for iCEBreaker Interface 1
  8. Unplug the iCEBreaker and plug back in to load the new drivers

You can download the prebuilt toolchain for windows here which contains iceprog.exe: https://github.com/FPGAwars/toolchain-icestorm/releases
If you add the install folder to your bash path then you can just run iceprog.exe from your Makefile instead of iceprog. E.g. export PATH=/mnt/c/Users/Ed/Downloads/icestorm/bin/:$PATH. One caveat is that it will expect Windows paths rather than unix paths. It happens to work fine for WTFpga because that uploads the file relative to the current directory. For any other file paths you will probably need to translate them using them wslpath -w. Or you can just build in WSL and program your device in cmd.exe if it’s easier. I might work on a wrapper script that will transparently do the path translation but it’s not totally trivial.

2 Likes

Hi,

Thanks for the help, just to be shure, i downloaded and extracted the custom iceprog in the Windows side of my file system. Then added on the WSL side i add it to the bash PATH, go to the wtfpga directory and run

$ iceprog.exe wtfpga.bin
No such file or directory
C:\Users\me\Downloads\icestorm\bin\iceprog.exe: can’t open ‘wtfpga.bin’ for reading

But i copied wtfpga.bin to a usb stick, moved the file to the Windows side (didn’t tested another way to transfer the file) and ran iceprog.exe from there, i was able to program and verify the bitstream download :smiley:

I will try to search a way to solve the issue when trying to upload from WSL, it is a bit anoying to transfer the file to Windows.

Thanks for the help :slight_smile:

The “No such file or directory” error is probably just due to working in a folder that doesn’t exist in the Windows filesystem. If you clone wtfpga under /mnt/c/<path> then WSL should run iceprog.exe with the working directory set to C:\<path> and it will be able to see your bin file.

1 Like

Thanks for the reply, i will try again this weekend :slight_smile: