SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
By markaren1
#156801
Hi All,

Hopefully this won't be too far OT, but there is a wide audience here, and someone may be able to save me a heap of time...

I am involved with an Amateur Radio, Digital TV project - see http://www.idesignz.org/DigiLiteZL/DigiLiteZL.htm

Phase two of this project was the inclusion of a DE0-nano FPGA board (Altera Cycle IV) as part of the modulator http://www.idesignz.org/DigiLiteZL_FPGA ... L-FPGA.htm

Current work is to add an SD card, so that MPEG video can be loaded from the card into SD RAM at power up to make the unit stand-alone. This will be used as part of test equipment for ground station set-up associated with the transmission of Digital Amateur TV from the International Space Station later this year.

I am looking for an open source, license free SD card interface (SPI mode) along with FAT16 drivers that will compile using GCC (for NIOS II), preferably with some examples.

I will be most interested to know of any projects that might make a good starting point for this next phase.

Many thanks,

Mark
User avatar
By CircuitBurner
#156841
Howdy,
very cool project you have.
Im a Ham and work satellites and have hit the ISS digipeter with packets (no live crew contact yet), mostly working the LEO Ham satellites with somewhat simple cross-band ground station gear (144/440mhz)...
If I understand what your trying to do, with my limited experience here, getting SD card storage to hold and play fast video (or anything near it) will be a tall order if youre using a small micro controller like arduino or PIC running at 16mhz or whatever. Slow storage, or a stream reduced in resolution is entirely possible.... but I will leave this up to the real authorities in these parts... I just wanted to say 73's and wish you luck! KF5DPO, EM-12 Grid Sq.
By markaren1
#156856
Thanks CircuitBurner.

The SD driver is only required to load a 10MB MPEG Transport Stream into the 32MB SDRAM at power up, but I don't want to wait half an hour for this to happen. A hundred seconds might be OK, but this is way faster than anything I have seen so far with open source FAT drivers using available CPU horse-power.

Having been around the houses several times trying to meet the above requirements, I have settled on a home-cooked driver that will
- Only support of a small number of files
- Be Read Only
- Use FAT16, using 8.3 naming
- Use Block Read only

To that end, I have been pulling apart the FAT16B spec, and have loaded and analyzed from the SD card (using the NIOS II processor on the FPGA)
- Master Boot Record
- FAT16 Partition 1
- FAT directory entries

Next step is to figure out the linked list associated with the cluster entries, and write the block loader.

Hopefully things are moving in the right direction.

Regards,

Mark
By UhClem
#156878
There are two parts of the speed problem.

The first is the interface with the SD card. Using the SPI interface the best you can do is 25Mbps assuming that your SPI interface can run that fast. You could go faster by using a SDIO interface, either something in the FPGA or a cheap standalone interface chip.

The second is the software that implements the FAT file system. As you have discovered the available code is rarely written with speed in mind. I had the same problem and wrote a fast version but it mostly writes at high speed with the ability to read one block of a file for configuration data.

By writing your own version you can include the features you need and optimize the read code. I know that multi-block writes are faster than block at a time and suspect that the same might be true for reads.