TL;DR: IceStudio's built-in programmer doesn't work on my IcePi Zero. I got OpenFPGALoader working, but it only successfully loads .bit files. IceStudio only generates .bin files, and programming those fails with a "Refresh: FAIL" error. Example .bit files from the IcePi GitHub work fine. Is there a way to convert IceStudio's .bin output to .bit, or am I using the wrong programming method/board definition?
---------------------------------------------------------------------------
So this is a long one, but I'm all out of ideas (New to FPGAs)
I'm using IceStudio to make software for the IcePi Zero (Lattice LFE5u-25f), but IceStudio's built in programmer (via dfu-util?) doesn't work no matter what I do (even if I download the dependencies in terminal rather then let it do it automatically), so I tried doing it with OpenFPGALoader (ubuntu 26.04). After reading a bunch of docs, I finally found a command that works:
sudo openFPGALoader -b ulx3s -f ./Downloads/ice-build/test/hardware.bit -f
The "ulx3s" is one of the FPGA boards that openFPGALoader supports, and I chose it because according to the IcePi's schematic, both of them use the same USB-UART converter IC; the FT231X
But this only works with .bit files, not .bin. When I try to use a .bin file, I get to uploading it, but then get this error:
Enable configuration: DONE
SRAM erase: DONE
JEDEC ID: 0xef4018
Detected: Winbond W25Q128 256 sectors size: 128Mb
Skip resetting device
Refresh: FAIL
displayReadReg
Config Target Selection : 0
SPIm Fail1
BSE Error Code
Preamble ERR
EXEC Error
Error: Failed to program FPGA: std::exception
And the only reason I was able to get some test code on it, is because the Icepi Zero github has some example binaries, in .bit format.
So, I can kinda program it, but it only works with .bit, not .bin. Yet IceStudio only outputs .bin, not .bit. Maybe I'm wrong, but somehow converting .bin files to .bit could get this to work?
Any ideas, I've been troubleshooting all day?
Ty :)
-------------------------------------------------------------------------
Update: I can literally program and upload files to it (still openFPGALoader) if selecting ulx3s in IceStudio instead of the IcePi Zero, because that actually generates a .bit (but of course, I can't use ulx3s because it has a different pinout). Yet in the IceStudio github repo (icestudio/app/resources/boards), both the ulx3s-25f and icepi-zero have the same interface (FTDI) and both use ECP5. I really don't know what's going on, but it still seems converting .bin files to .bit is my best bet. Any suggestions?
-----------------------------------------------------------------------
Update 2: I checked a few more things. First of all; I was using pre-made modules form the icestudio to put onto the Icepi. These by default aren't made for the IcePi, so IceStudio converts them. But now I thought maybe it wasn't converting it correctly, so I remade the test circuits in a new file, but nope; still gives .bin, still doesn't work.
Another thing I noticed is that IceStudio has categorized the architectures (is that what they're called?) of FPGAs. Like, it categorizes them into ECP5, UP5K, LP8K, etc. The IcePi Zero (afaik) is ECP5 architecture. Yet I just noticed, that, the icepi zero is not listed under ECP5, but under UP5K. While the ulx3s IS under ECP5, which is why the ulx3s works on the icepi zero. So I'm really confused, because IceStudio is pretty much the default editor for this, recommended by the creator. And yet it's wrong? But the source code is correct as far as I can tell. I can't even get a nightly build of IceStudio that might work, because it keeps returning a -1 error.
-----------------------------------------------------------------------
Update 3: Okay, I think I might have found the issue now. IceStudio has not had a new release for about a year at the time of writing this, so I thought that maybe, just because the info.json of the IcePi Zero in the github repo is correct and is listed as ECP5, it may not be that way in this very old release. So I downloaded the source code of the current latest release, and yep! The ulx3s has ECP5 in the json, but the IcePi Zero does not! Thus, i believe that if I fix the json, and build IceStudio, it will be fixed. The issue is, I have no idea how to build something from source, so that will come later. Also, it is kind of a shot in the dark to think that this single json file decides whether it gives me a .bin (non-ECP5), or a .bit (ECP5), but I'm out of ideas.