cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
5,411 Views
Registered: ‎06-29-2009

Write to Compact Flash with microblaze on ML405

Hi,

 

Is it possible to write  to the compact flash card using microblaze?  I did try the demo for reading and rebooting from the CF card with µBlaze but didn't see a write procedure. (The only thing I did read was that you have to put the CF in a computer in order to write to it).

 

I actualy would like to write to it as standalone app.  No Linux or so ...

 

 

Serge.

Tags (4)
0 Kudos
2 Replies
Highlighted
Adventurer
Adventurer
5,407 Views
Registered: ‎09-15-2008

Re: Write to Compact Flash with microblaze on ML405

Hi

Xilinx provides the XilFATFs library to manage read/write access to files stored on a Xilinx® System ACE™ compact flash or microdrive device. Be aware that in the EDK 10.1 release, the deletion of file does not work.

Regards

 Mariano

0 Kudos
Highlighted
5,371 Views
Registered: ‎06-29-2009

Re: Write to Compact Flash with microblaze on ML405

Hi,

 

Thanks for reply.  This is what I  needed.  I have been trying this,  but till now I didn't succeed to make it work ....  I can open a file, but not read it.  I looked at some examples and read the short pdf file on XilFatFS, but I cannot find the problem.

 I also formatted the CF in FAT16 and used mkdosfs.exe like explained on another threath of XilinxForum  ...  just to be sure.

 

 

 

Some code, data output and the mss are given below:

 

Maybe you or someone else has some idee? .....

 

Thanks,

 

Serge

 

 

 

The basic code :

 

SYSACE_FILE *fileptr; 

volatile Xuint32 numread;    ///  I realy don't know why volatile has tobe here .... but without this it doesn't work .... I had it on another situation too

Xuint8 Buffer;

 

 

fileptr = sysace_fopen("A:\\SERGE\\TESTCF.TXT", "r");     /// here I get the value != 0  so it's OK ... 

 

/// the next code should read the data byte per byte (got it from refference designs ML405)

 do
    {
      numread = sysace_fread(Buffer, 1, 1, fileptr);
      if (numread != 0)
        {
          xil_printf("%0X2 (%0X2 = %c) - ", numread, Buffer, Buffer);
        }
    } while (numread);

 

This give me next result on hyperterminal:


12 (58502 = P) - 12 (58502 = P) - 12 (58502 = P) - 12 (58502 = P) - 12 (58502 =
P) - 12 (58502 = P) - 12 (58502 = P) - 12 (58502 = P) - 12 (58502 = P) - 12 (585
02 = P) - 12 (58502 = P) - 12 (58502 = P) - 12 (58502 = P) - 12 (58502 = P) - 12
 (58502 = P) - 12 (58502 = P) - 12 (58502 = P) - 12 (58502 = P) - 12 (58502 = P)
 - 12 (58502 = P) - 12 (58502 = P) - 12 (58502 = P) - 12 (58502 = P) - 12 (58502
 = P) - 12 (58502 = P) - 12 (58502 = P) - 12 (58502 = P) - 12 (58502 = P) - 12 (
58502 = P) - 12 (58502 = P) - 12 (58502 = P) - 12 (58502 = P) - 12 (58502 = P) -
 12 (58502 = P) - 12 (58502 = P)

 

 

The content of the txt file:     "Yo wasup, This is a file on the CF."

 

 

 

the MSS file:


BEGIN LIBRARY
 PARAMETER LIBRARY_NAME = xilfatfs
 PARAMETER LIBRARY_VER = 1.00.a
 PARAMETER PROC_INSTANCE = microblaze_0
 PARAMETER CONFIG_FAT12 = false
 PARAMETER CONFIG_DIR_SUPPORT = true
 PARAMETER CONFIG_MAXFILES = 5
 PARAMETER CONFIG_BUFCACHE_SIZE = 1024    ##  When I put this to 1 or a low value ...  then  the microblaze gets in a loop ...

END

 

 

0 Kudos