Hi,Does anyone know solutions to configure FPGAs from SD card? It must be either of the below. I prefer the latter one, but information of any other solutions will be appreciated. (1) A Nios II in another FPGA read from SD and load the FPGAs. (2) A hardware logic in a CPLD read from SD and load the FPGAs. Regards
The first solution is easy. You only need your Nios (or any other processor) drives a spi master which is used to access SD. This for the SD physical layer: depending on how data is stored on your SD, you may need more or less effort in designing the applicaiton (i.e. file system management)Clearly this solution involves a greater BOM cost, unless you already have a second processor external to the fpga and you can use it for the configuration task The second solution would be more correct. I think what you choose depends on how much effort you want to put in the design. The initialization and basic access to SD is not that complicated, especially if you don't need to support all SD device variants. But in the CPLD solution you surely can't use a file system and must load the fpga configuration image as raw data in the SD flash eprom.
Hi Cris72,Thank you so much for the quick answer. I'd like to use second if I can. May I ask if you would know any ways to write raw data into SD card? Regards
I have done this, but I have an external CPU to do that for me. If you use a CPLD, there are a few details (as Cris72 said) you have to take care of since you cannot implement a file system on a CPLD. However, all the file system would let you do is locate the file data. If you know where that data is located, then the rest is relatively easy. You can start by storing your file as raw data starting at address 0. To do this, use the DD command on a linux box.
dd if=<config_file> of=/dev/<sdcard_device>where <sdcard_device> is something like /dev/sda, /dev/sdb, ... You cannot have a partition in this card, so don't use /dev/sda1, /dev/sdb1, ... This command will basically store your <config_file> in the card starting at address 0. Remember that if you are using SDHC cards, they are block-oriented. So address 1 means address 512, while in SD cards, address 1 means address 1. Hope this helps.
Hi gee,Probably you have already done this: a good starting point is download the SD card simplified specification from www.sdcard.org and read it. Here you'll easily find the basic commands to detect SD card type, initialize it and write/read data. I started this way and in less than two days I built my application from scratch, complete with file system (I used FatFs open source module). My task was easier, since I accessed SD card through Nios and spi port; so it was simply a matter of sending the right command sequences. With a CPLD it will be much more challenging. Good luck! Cris