UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Explorer
Explorer
11,571 Views
Registered: ‎05-15-2009

sysace_fopen hang

Jump to solution

Hello,

 

I'm trying to write a file into CF, however the software application hangs in sysace_fopen(fileName, "w"); instruction.The file is to be created at instruction call.

 

Any ideas of what the problem could be?

 

Best,

JM

0 Kudos
1 Solution

Accepted Solutions
Explorer
Explorer
13,983 Views
Registered: ‎05-15-2009

Re: sysace_fopen hang

Jump to solution

Hello,

I have managed to succeed on writing to the CF :) . Apparently the problem was on CF formatting. Simply placed the CF onto the USB CF card reader, downloaded mkdosfs from http://www1.mager.org/mkdosfs/mkdosfs.zip, and runned from the windows command prompt:

 

c:\mkdosfsfolder> mkdosfs f:\

 

Note that in my case, the CF drive is F:\ when attached to the PC. So, bottom line, remember to format the CF, even if it's the default CF card that comes with the evaluation board, in my case, the ML402.

 

Hope this helps anyone with this same issue.

Best,

JM

 

 

0 Kudos
8 Replies
Visitor pyrrhus
Visitor
11,527 Views
Registered: ‎06-11-2009

Re: sysace_fopen hang

Jump to solution

Hi,

 

I had exactly the same issue with EDK 10.1 SP 3. I did not find the reason but a simple fix I used was to call the sysace_readdir(...) function before sysace_fopen function.

 

Hope this helps,

Regards,

 

Pierre-André

0 Kudos
Explorer
Explorer
11,504 Views
Registered: ‎05-15-2009

Re: sysace_fopen hang

Jump to solution

Hello,

Thank you, however it didn't fix. I'm also using EDK 10.1 with SP3. Here's what I have in software:

 

main()
{

 

    xil_printf("\033[H\033[J"); //clears the screen
    xil_printf("Hello!\n\r");

unsigned char buffer[] = "sasfsfsdfgasdgdfgsdf\n\r";

 

    dirent de[MAX_DIR_ENTRIES];
    char* path = "a:\\web";
    int numDirEntries = 0;


    char fileName[] = "a:\\test2.txt";
    SYSACE_FILE* file; // file descriptor
    int n = 0;

 

    numDirEntries = sysace_readdir(path, de, MAX_DIR_ENTRIES );
    file = sysace_fopen(fileName, "w");
    if (file)
    {
        sysace_fwrite(buffer, 1, sizeof buffer, file);
        xil_printf("# of bytes written: %d\n\r", n);
                sysace_fclose(file);

    }
    else
    {
        xil_printf(" - Error: could not write to CF\n\r");
    }

 

}

 

However, only "Hello" is printed and nothing is written in the CF. Any suggestions?

 

Best,

JM

0 Kudos
Visitor pyrrhus
Visitor
11,502 Views
Registered: ‎06-11-2009

Re: sysace_fopen hang

Jump to solution

Hi,

 

It turned out that it the issue was not really solved neither for me... However, I found several types of errors that could make the initialization function hang. For instance, an incorrect format of the CF card (as explained on http://www.xilinx.com/support/documentation/data_sheets/ds080.pdf,page 10) makes the function hang without error. Basically, if you format the CF with XP and the card is small (for instance 32MB), the card is unusable with the SystemACE controller !

 

What I do now (and it works, is)

 

- Use a CF formatted with mkdosfs with mkdosfs -f 1 -F 16 -s 2 -R 1 <device>

- Initialize the SystemAce controller with :


    XSysAce pCF;
       
    XStatus s = XSysAce_Initialize(&pCF, XPAR_SYSACE_COMPACTFLASH_DEVICE_ID);       
   
    if(s != XST_SUCCESS)
    {
        xil_printf("Error during CF init\r");
    }

    s = XSysAce_SelfTest(&pCF);   
    if(s != XST_SUCCESS)
    {
        xil_printf("Error during CF self test\r");
    }

    if(!XSysAce_IsCFReady(&pCF))
        xil_printf("CF not ready\r");

 

And after that, the card works (except that I can not write to it... which I am currently investigating...)

 

Hope this helps,


Regards,

Pierre-André

0 Kudos
Explorer
Explorer
11,500 Views
Registered: ‎05-15-2009

Re: sysace_fopen hang

Jump to solution

Hello pyrrhus,

Thank you very much. I'm running the code with the xmd debugger and I checked that sysace_fopen is passing, the problem is in sysace_fwrite(). As soon as I realize in fact where it hangs I get back to you. I'm using the 32MB CF that came with my virtex 4.

 

Please, post if you also find out the problem.

 

Best,

JM

0 Kudos
Explorer
Explorer
13,984 Views
Registered: ‎05-15-2009

Re: sysace_fopen hang

Jump to solution

Hello,

I have managed to succeed on writing to the CF :) . Apparently the problem was on CF formatting. Simply placed the CF onto the USB CF card reader, downloaded mkdosfs from http://www1.mager.org/mkdosfs/mkdosfs.zip, and runned from the windows command prompt:

 

c:\mkdosfsfolder> mkdosfs f:\

 

Note that in my case, the CF drive is F:\ when attached to the PC. So, bottom line, remember to format the CF, even if it's the default CF card that comes with the evaluation board, in my case, the ML402.

 

Hope this helps anyone with this same issue.

Best,

JM

 

 

0 Kudos
Visitor pyrrhus
Visitor
11,462 Views
Registered: ‎06-11-2009

Re: sysace_fopen hang

Jump to solution

Hello,

 

I also managed to write to the CF... The options I manually set with mkdosfs were not completely correct and using it without any options resulted in completely working CF !

 

Thank you for the idea !

 

Regards,

Pierre-André

0 Kudos
Observer grando
Observer
10,536 Views
Registered: ‎09-15-2009

Re: sysace_fopen hang

Jump to solution

Hello,

 

I'm facing a very similar (if not the same) problem with EDK 11.2 and a XUPV5.

 

Using BSB I created a system as simple as it can be: Microblaze, SysACE, UartLite. Now I'm trying to test read/write operations in the CF that came with the board (1GB).

 

The .mss file was changed accordingly. The partitions of CF were deleted (so that now it has only one) and formated with mkdosfs, as already mentioned.

Both the "TestApp_Peripheral_microblaze_0" application and the XSysAce_SelfTest succeeded.

 

The problem is when I try to use sysace_fopen. Then nothing happens, not even the print command *before* sysace_fopen....

 

This is the code I'm using:

 

 

#include "xparameters.h" #include "stdio.h" #include "sysace_stdio.h" int main(void) { char FileName[] = "a:\\test.txt"; SYSACE_FILE *infile; int numread,i; char readBuffer[10]; print("-- Entering main() --\r\n"); infile = sysace_fopen(FileName, "w"); if(infile){ xil_printf("Reading file : %s\n\r", FileName); numread = sysace_fread(readBuffer, 1, 10, infile); xil_printf("data %s\r\n", readBuffer); } else{ xil_printf("Can't open file : %s\n\r", FileName); return 0; } sysace_fclose(infile); print("\r\n\n"); return 0; }

 

Does anyone knows what's still going wrong?

Thanks in advance,

Carmela

 

 

 

0 Kudos
Explorer
Explorer
10,317 Views
Registered: ‎05-15-2009

Re: sysace_fopen hang

Jump to solution

Make sure you are allocating enough heap and stack spaces.

 

Best,

JM

0 Kudos