cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Visitor
Visitor
8,056 Views
Registered: ‎03-03-2014

Write 1M data to Compact Flash

Hello,

 

I have a LX110T virtex5 board with sysace controller, and i  can write a file to the compact flash, but the data i write is small,i only can write 80k datas to CF card one time.now i want write 1M date to CF card.

 

1.What should I do?if i want to write 1M date to CF card.

2.Can anyone tell me if I can use sysace_fwrite without erasing the existing contents of the file? I know sysace_fopen only has two modes, "r" or "w", but shouldn't there be a mode to avoid erasing the contents of the existing file and "append" a new string like the "a" mode of fopen in C?

 

 

 

Best,

HCL

0 Kudos
10 Replies
Highlighted
Visitor
Visitor
8,017 Views
Registered: ‎03-03-2014

Re: Write 1M data to Compact Flash

i fix it.ok now

0 Kudos
Highlighted
Adventurer
Adventurer
7,699 Views
Registered: ‎01-15-2013

Re: Write 1M data to Compact Flash

Hello,

 


I am trying to do the same on a ML605 board. I want to Read/write files from compact flash. But for some reason , my file open always returns a failure. Do you know if there is any reference design available from Xilinx? I have attached my code below : 

 

#include <string.h>
#include "sysace_stdio.h"

int main()
{

	xil_printf(" Hello \n");
	const char *file="paul.txt";
	const char*mode="r";

	SYSACE_FILE *ps;
	ps=sysace_fopen (file, mode);

	if(ps==NULL)
		xil_printf(" FILE OPEN FAILED !!! \n");

	else
	{
		xil_printf(" FILE OPEN SUCCESSFULL !!! \n");
		int sysace_fclose (ps);

	}

	return 0;


}

 

0 Kudos
Highlighted
Xilinx Employee
Xilinx Employee
7,697 Views
Registered: ‎08-02-2007

Re: Write 1M data to Compact Flash

Hi,

 

This is a validated and tested reference design provided by Xilinx.

 

http://www.xilinx.com/support/documentation/boards_and_kits/xtp056.pdf

 

Type C test will help you perform a test on your CF card via system ACE.

 

--Hem

----------------------------------------------------------------------------------------------
Kindly note- Please mark the Answer as "Accept as solution" if information provided is helpful.

Give Kudos to a post which you think is helpful and reply oriented.
----------------------------------------------------------------------------------------------
0 Kudos
Highlighted
Adventurer
Adventurer
7,692 Views
Registered: ‎01-15-2013

Re: Write 1M data to Compact Flash

Thanks for the reply.

I have tested the board using compact flash. However, I would like to store some information in a text file using microblaze design. I would like to know if there is any reference design for to store data in compact flash?

Paul
0 Kudos
Highlighted
Xilinx Employee
Xilinx Employee
7,686 Views
Registered: ‎08-02-2007

Re: Write 1M data to Compact Flash

Hi,

Can you try the lab mentioned here? This might be an older link but the procedure is relavent.

 

--Hem

----------------------------------------------------------------------------------------------
Kindly note- Please mark the Answer as "Accept as solution" if information provided is helpful.

Give Kudos to a post which you think is helpful and reply oriented.
----------------------------------------------------------------------------------------------
0 Kudos
Highlighted
Adventurer
Adventurer
7,678 Views
Registered: ‎01-15-2013

Re: Write 1M data to Compact Flash

 

Thanks for the reply again. 

 

I saw this material and there are some issues with that lab material: 

1. The tutorial do not describe the hardware settings of the project

2. Couple of namely ReadText.c, StackAndHeap.h & StackAndHeap.c are not avaliable to general users.

 

Here is a summary of my project:

1. Created an XPS project and added compact flash IP to the microblaze design 

2. Generated bitstream and exported the design to SDK

3. Created a new software project - added the Libxil FAT system library

4. Wrote a C code to open a file 

 

Problems faced: 

1. The fileopen function was returning a failure both in "r" or "w" mode. 

2.  I am still not clear about the jumper settings. ( in the ML605 userguide, it shows one settings but xilinx reference design -built in self test reference design shows another settings. 

 

0 Kudos
Highlighted
Adventurer
Adventurer
7,672 Views
Registered: ‎01-15-2013

Re: Write 1M data to Compact Flash

 

 

Hello,

 

I debugged the code a little more. I found that there is a lock forced by either microblaze or controller.

 

The code returns a XST_DEVICE_BUSY( as per SDK documentation  return  XST_DEVICE_BUSY if the lock was not granted because the configuration controller currently has access to the CompactFlash."). 

 


This suggests that the initialization of SYSTEM ACE for reading/writing is not done properly.

 

Anyone has any idea why this happens???

 

Paul

 

0 Kudos
Highlighted
Adventurer
Adventurer
7,662 Views
Registered: ‎01-15-2013

Re: Write 1M data to Compact Flash

 

 

My problem is solved. This was because I formatted the flash card. 

 

I restored contents of the orginal design and then it worked fine. 

 

Thank you. 

0 Kudos
Highlighted
7,466 Views
Registered: ‎05-15-2014

Re: Write 1M data to Compact Flash

Hi can someone help me about opening a compact flash file in xilinx sdk.

I am using xilinx 13.1 and xupv5-lx110T board.

 

My doubt is,

If the file doesnt exist in compact flash, and if I open file in write mode, will the file be created?

 

In any case even if I open the file in read mode (after formatting the compact flash and creating the file), the file pointer is always returning NULL in both read mode and write mode.

 

Do I have to change DIP settings for programming mode in SDK for compact flash. I tried the above program putting DIP setting in default configuration.

int main()
{

    xil_printf("\n\r Hello \n\r");
    const char *file="test.txt";
    const char*mode="w";

    SYSACE_FILE *ps;
    ps=sysace_fopen (file, mode);

    if(ps==NULL)
        xil_printf(" FILE OPEN FAILED !!! \n\r");

    else
    {
        xil_printf(" FILE OPEN SUCCESSFULL !!! \n\r");
        sysace_fclose (ps);

    }

    return 0;


}

 

Can someone please help this issue.

0 Kudos
Highlighted
Adventurer
Adventurer
2,171 Views
Registered: ‎01-15-2013

Re: Write 1M data to Compact Flash

Hello,

Did you change to software setting of application to include write support. The following link might also help:

http://ideaprojecthardware.blogspot.ca/2014/04/writingreading-data-from-compact-flash.html
0 Kudos