Ok, today i learnt a few things. :)
So i thought id give programming the Olimex board a try using an FT232H programmer (i have already tried using my hw-usbn-2b via diamond programmer which works)
Here are some things i noticed along the way.
1. Running icestudio in WSL is totally possible, but need to remember to attach the usb device to WSL e.g.
usbipd attach --wsl --busid 1-2
2. icestudio develop branch does not support apio version 1.2 at this time so i needed to make a few tweaks as i needed the latest versions to allow overriding of the programmer cmd... although as i didnt end up using that option it might not have been necessary in the end.
I did need to create custom boards.jsonc, programmers.jsonc and custom apio.ini which i dont know if they would have been supported in apio 0.9.5 but i had already made the changes to allow the latest toolcahin to install.
3. Here is where the pain started for me:
The only FTDI board i had to hand was the Adafruit FT232H breakout board. and after quite a few hours come to the conclusion that it just flat out doesnt work with iceprog.
apio raw -- iceprog -t -v
init..
cdone: high
reset..
cdone: high
read flash ID..
Extended Device String Length is 0xFF, this is likely a read error. Ignoring...
flash ID: 0xFF 0xFF 0xFF 0xFF
cdone: high
Bye.
Nothing would stop 0xFF being read as the flash id no matter what i tried.
what DID work (via
flashrom )~/development/fpga/ice-build/02. Two LEDs/_build/default$ sudo flashrom -p ft2232_spi:type=232H,port=A,divisor=16 -v full.bin
flashrom unknown on Linux 6.6.87.2-microsoft-standard-WSL2 (x86_64)
Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns).
Found Eon flash chip "EN25QH16" (2048 kB, SPI) on ft2232_spi.
Verifying flash... VERIFIED.
So given that i can actually program the btistream means at least the wiring wasn't the issue....
Final solution (openfgpaloader)
Apio.ini
[env:default]
board = ice40-hx1k-evb-ft232h
top-module = main
boards.jsonc
{
"ice40-hx1k-evb-ft232h": {
"description": "Olimex iCE40-HX1K-EVB programmed via external FT232H (VID:PID 0403:6014) using iceprog",
"fpga-id": "ice40hx1k-vq100",
"programmer": { "id": "openfpgaloader_ft232h_spi" },
"usb": {
"vid": "0403",
"pid": "6014",
"product-regex": ".*"
}
}
}
programmers.jsonc
{
"openfpgaloader_ft232h_spi": {
"command": "sudo",
"args": "openFPGALoader --spi -c ft232 -f -o 0"
}
}
after adding these (which is very cool APIO allows them all to be added and used in a project.)
I have an ice studio instance that can program the Olimex board via my programmer.
"/home/rob/.icestudio/venv/bin/apio" upload -p "/home/rob/development/fpga/ice-build/02. Two LEDs"
Loading custom 'boards.jsonc'.
Loading custom 'programmers.jsonc'.
Using env default (ice40-hx1k-evb-ft232h)
Setting shell vars.
Checking device presence...
- FILTER [VID=0403, PID=6014, REGEX=".*"]
- DEVICE [0403:6014] [1:4] [��������] [������] [��������]
--------------------------------------------------------------------------------
sudo openFPGALoader --spi -c ft232 -f -o 0 _build/default/hardware.bin
empty
write to flash
Can't read iProduct field from FTDI: considered as empty string
Can't read iManufacturer field from FTDI: considered as empty string
Can't read iSerialNumber field from FTDI: considered as empty string
Jtag frequency : requested 6.00MHz -> real 6.00MHz
Detail:
Jedec ID : 1c
memory type : 70
memory capacity : 15
RDSR : 00
WIP : 0
WEL : 0
BP : 0
TB : 0
SRWD : 0
Open file _build/default/hardware.bin DONE
Parse file DONE
flash chip unknown: use basic protection detection
Erasing: [==================================================] 100.00%
Done
Writing: [======================================== ] 78.66%
Writing: [==================================================] 100.00%
Done
========================= [SUCCESS] Took 1.57 seconds ==========================
Conclusion
My assumption is that iceprog doenst like the
232H board at all for reasons unknown, I would have probably been absolutely fine with a
2322H board which ill order now and see if thats true.
Ive learnt how to override boards, override programmers and add custom apio.ini files.
Ive learnt how to get WSL to recognise FTDI devices.
Question
1. Is the latest version of APIO likely to be supported in icestudio by default?
2. As far as programmers go, can someone recommend a FT2232H breakout board that isnt from ALIEXPRESS as i dont want to wait and would prefer something nextday that is known to work e.g.
https://mou.sr/45kBkcZAnyhow, i have a working setup albeit a bit painful getting there with the bits i had to hand.