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++
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
12748 Discussions

CF control(using FAT without OS)

Altera_Forum
Honored Contributor II
1,567 Views

Hi.. 

I'm Korean student.. 

So, my english is not good.. sorry.. 

 

I'm doing small project.  

This project is using Compact Flash memory. 

So, I need controller of CF. 

Then. I'm used NIOS II embedded processor. 

and use "Compact Flash Hardware & Software examples for nios II 5.0" 

and use "the DOSFS distribution archive"... 

 

I can used and test Software examples for nios II 5.0 

but I don't know how to connect between both source. 

 

This project is very important to me.  

help me please.... 

 

summary. 

1. I want use CF Memory base FAT file system without any OS. 

what is most good method to use. 

 

2. I'm try to connect "Compact Flash Hardware & .. 

Software examples for nios II 5.0" and "the DOSFS distribution archive" 

but I dont' know how to modifiy.  

 

thank you for concern my question.  

I will be watching this forum every time.. please help me.... 

 

have a good time..
0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
631 Views

Okey Dokey, 

 

You have alot of reading and work to do. 

 

You need to start with getting the Compact Flash hardware and example software working. This involves using SOPC builder to put the Compact Flash hardware in your NIOS II configuration. Since I am a software programmer... I cannot help you with the details on that. Once you have the Compact Flash hardware in the FPGA you need to connect your FPGA to your physical hardware (a compact flash slot/connector and a compact flash card). 

 

Use the NIOS II IDE to make a new blank project based on your NIOS II configuration. Then copy the example files *.c and *.h that came with the Compact Flash IP. You should then be able to compile and run the example code. 

 

Once the example code is working you then will need to hook in the FAT file system code. I would suggest starting a new blank project based on your existing system library (so you don't mess up the working code). Copy all of your *.c and *.h files to your new blank project. You will need to then hook in your FAT code to your compact flash code. Read the example project and FAT code documentation to figure out exactly what you need. Summary of what you need:  

 

IDE_initialize 

IDE_deinitialize 

readLogicalSector 

writeLogicalSector 

 

Those are the basic functions fron cf_ideutils.c that you will need for the FAT file system code to work... there maybe others ... 

 

Then you can rewrite the main() function in the cf_test.c file to open a FAT file... write something to it... and close the file. 

 

Once you get this working you can then move the essential code over to your real program... or if it is simple enough just write it in cf_test.c... 

 

That is essentially it. Remember to get the example code working first... this is very very very important! Without it working the FAT file system code will never work and you will not accomplish your goals. 

 

Have Fun!
0 Kudos
Altera_Forum
Honored Contributor II
631 Views

Hi Karis, 

 

We also had to implement FAT file system on our own-design board without OS. I found two very useful papers on the subject, one by Jack Dobiash and another by Microsoft - fatgen102.pdf. Both are easy to find on google. In fact, with both documents there is everything you need to know to write a FAT file system (apart form details of long file names). These may help you understand the example project. 

 

If your project only needs to read and/or write CF cards then you need only write those functions. Use a CF card read/writer on a PC to format and manage the cards. 

 

CF cards now have high capacity for relatively little cost so it makes sense to only support FAT32 (on 64Mb+ cards). 

 

Good luck. 

 

Banx.
0 Kudos
Altera_Forum
Honored Contributor II
631 Views

Hi All, 

 

You can use u-boot as it supports both CF and FAT32. If you're not interested in 

using u-boot you may still find the filesystem code useful. 

 

I haven't played with the u-boot CF code for Nios since I retired my 1C20 board -- and there 

were some hardware related issues with that board as well. But on other architectures/hardware 

the CF/FAT32 feature was very nice. 

 

Regards, 

--Scott
0 Kudos
Reply