Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++

Compact Flash Basics

Altera_Forum
Honored Contributor II
1,246 Views

Hi All, 

 

I have a PCB with a Cyclone EP1C3 fitted. I've made a Nios2 core which includes the CompactFlash Interface (True IDE Mode). All I want to do is write a file onto the flash card when it's connected to my PC. Move the card onto my target PCB and get the Nios to read a predetermined filename, and spit the contents out a byte at a time to my custom VHDL in the cyclone chip. 

 

Having just read the readme.txt in the Compact Flash Tested IP zip, it talks about supporting LBA or CHS addressing, and says no file system support is provided. 

 

Is what I want to do easily possible? Can someone point me in the right direction for more info about how to do it? Am I expecting too much out of the 1C3 with no external memory available? 

 

All help appreciated. 

 

Bruce.
0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
550 Views

Hello Bruce, 

 

I am doing the same as you but with Cyclone 1c20. At this moment, I am trying to make a system file to access files on Compact Flash. If I obtain something, I will tell you, 

 

Good luck
0 Kudos
Altera_Forum
Honored Contributor II
550 Views

The missing piece is a filesystem (FAT filesystem). The example software in the compact-flash support download on this forum gives you "raw" access to the card... not terribly useful for reading in things written by a PC. 

 

Options available: 

- google around for some open/free fat filesystem code and port it  

- locate the fat spec and write your own 

- try eCos -- it includes compact flash drivers, fat file system, networking, etc. Only disadvantage is that it is it is not at all automatically intergrated with the Niso II IDE/HAL/build flow.. it provides all its own. Once you have an eCos library setup and configured how you want it, you can run/debug from the IDE - but its more of a power-user thing currently. 

 

The eCos for Nios II document included with the download also gives the basic steps to get compact flash working.
0 Kudos
Altera_Forum
Honored Contributor II
550 Views

Search elsewhere on this forum for FAT file system. There are two that I have test that work DOSFS and FATFS (ELM Chan). Both work but I like the FATFS much better because it is much faster than DOSFS in my opinion.

0 Kudos
Reply