Programming the FPGA
Added by Emmett Bradford over 12 years ago
I have read both forum entries of the same name.
The first one seems to be most applicable, since I have the MityARM-1808F with the LX16 FPGA.
I followed the instructions from the first post, which was difficult in iMPACT.
The trick was to:
1. Delete the FPGA Device.
2. Add Device (which asks for the bit filename, for which I browsed to my bit file)
3. "Edit / Rename PROM FIle" to the bin file in my real directory.
Until you do these 3 things, it's lost and generates errors.
Now iMPACT is generating a bin file, whether it is correct - I'm not sure.
However, it is still not loading from uboot, at least there is no DONE LED.
I notice that iMPACT says "Parallel PROM" in both MityDSP_L138.ipf and IndustrialIO.ipf.
MityDSP_L138.ipf says 512K and IndustrialIO.ipf says 1M.
Is that correct?
Isn't it an SPI flash?
Also, I don't remember if the DONE LED ever came on even with your factory configuration.
Should it have?
I'm attaching a text file from the COM1 terminal.
Replies (4)
RE: Programming the FPGA - Added by Tim Eastham over 12 years ago
Emmett and I were able to get the DONE LED by calling loadfpga after the loadb 0xc0700000. The problem is that when we setup the bootfpga environment variable, it doesn't work.
I am calling the following:
loadb 0xc0700000 ->this initiates the kermit transfer
sf probe 0
sf erase 0x580000 0x80000
sf write 0xC0700000 0x580000 ${filesize}
setenv bootfpga 'sf probe 0; sf read 0xc0700000 0x580000 0x80000; loadfpga 0xc0700000'
After I reboot the device, no DONE LED... Are we doing something wrong?
Thanks
RE: Programming the FPGA - Added by Michael Williamson over 12 years ago
Hi Tim / Emmett,
Did you remember to saveenv? (just checking)
A couple of things:
You might want to avoid using the "bootfpga" environment variable. We've had a couple of customers manage to brick their system by programming via the "bootfpga" an FPGA with code that drove, for example, the NMI pin high. The bootfpga command runs before control is given to the u-Boot shell, so if you put a bad FPGA image into FLASH there is no way to recover. We need to update the wiki about that.
Instead, I would recommend just making a separate u-Boot "script variable" to do it, e.g.:
loadb 0xc0700000 sf probe 0 sf erase 0x580000 0x80000 sf write 0xC0700000 0x580000 ${filesize} setenv progfpga "sf probe 0; sf read 0xc0700000 0x580000 0x80000; loadfpga 0xc0700000" setenv bootcmd "run progfpga; your_boot_commands_here...." saveenv
If you leave the countdown set (bootdelay variable) you will still be able to break in and get at the part before the fpga is loaded...
I don't see any problem with your code above other than the setenv bootfpga should use double quotes, ", and not a single quote.
For LX16's the binary image (with the swap bits enabled in impact) should fit in a 512K sized "Parallel PROM". For LX45s, you need a 1 Meg sized PROM. When the "bin" file is created, it only generates the data that is required to program the board, so the size that you pick for the Parallel PROM simply needs to be big enough for the image to fit (you should be able to use the "auto-select" option, if you like).
The examples posted on the wiki should successfully load.
The processor loads the FPGA using 8-bit slave select mode. The FPGA binary image must be loaded into RAM (your choice of media to get it there is, well, your choice). The loadfpga command then basically twiddles the program pin, chip select, cclk and write enable lines and drives the data to the FPGA using the EMIFA data bus.
If you are able to load the fpga with a RAM image, you can test that the image coming out of the FLASH is the same with the u-Boot crc or "cmp" (compare) command. (e.g., read the FPGA image back out of SPI flash to a different location in memory and compare the two imags).
Hope this helps...
-Mike
RE: Programming the FPGA - Added by Tim Eastham over 12 years ago
Thanks! That worked. An even better solution than the bootfpga solution.
I was basing what I did on the wiki page for Programming the FPGA (http://support.criticallink.com/redmine/projects/arm9-platforms/wiki/Programming_the_FPGA). It doesn't mention the saveenv command.
Thanks for the single quotes vs double quotes catch. The wiki uses single quotes.
Tim
RE: Programming the FPGA - Added by Michael Williamson over 12 years ago
Appreciate the feedback on the wiki page. I've updated it per your comments.
-Mike