cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Participant
Participant
4,426 Views
Registered: ‎10-19-2007

cannot write data to the CF card on an ML405 board

Hi,

 

I am trying to write data from the SDRAM to the CF card. I am using the xilkernel OS, I have activated the xilfatfs. The buffer size is set to 10240, the write support for FAT 16/32 in active, the support for FAT 12 is active, the DIR support is active. 

 

It generates the file I have specified, but doesn't write anything into it and when I use the debugger, it doesn't go over this line:

 

sysace_fwrite( (void*) buffer, 1, size, fp );

 

Does anyone have any idea what the problem could be?

 

Thanks

0 Kudos
4 Replies
Highlighted
Explorer
Explorer
4,418 Views
Registered: ‎05-15-2009

Re: cannot write data to the CF card on an ML405 board

 

Just one thought, are you correctly specifying the buffer size? It's better to have it implicitly determined in the call:

 

sysace_fwrite(buffer, 1, sizeof(buffer), fp);

 

The first parameter is a pointer to the first element of the buffer array. Anyway, this info is vague, post the code of the function calling the routine.

 

 

Best,

JM

 

Message Edited by jmonteiro-dme on 08-07-2009 03:39 AM
0 Kudos
Highlighted
Participant
Participant
4,414 Views
Registered: ‎10-19-2007

Re: cannot write data to the CF card on an ML405 board

This is the code that I use:

 

static void write_file( const char *file_name, const void *buffer, size_t size )
{
    SYSACE_FILE *fp = sysace_fopen( file_name, "w" );
    xil_printf("File has been opened");
    if( fp != NULL )
    {
        sysace_fwrite( (void*) buffer, 1, size, fp );
        sysace_fclose( fp );
    }
    else
        xil_printf( "Failed to open file '%s'\r\n", file_name );
}
 

//////////////////////////////////////////////////////////

 

write_file( "a:\\pict1.raw", (const void *)OUT_ADDR_1, 16384 * 1216 );

0 Kudos
Highlighted
Explorer
Explorer
4,412 Views
Registered: ‎05-15-2009

Re: cannot write data to the CF card on an ML405 board

Make shure you are specifying the correct buffer size. What is the type of out_addr_1 array? If type char, are you sure it has 16384*1216 bytes? The Sysace limit in bytes is much lower than that, normaly set by default to 10240 bytes in software platform properties under EDK.

 

Best,

JM

0 Kudos
Highlighted
Participant
Participant
4,409 Views
Registered: ‎10-19-2007

Re: cannot write data to the CF card on an ML405 board

Thanks for the help, I will look into it.

 

Istvan

0 Kudos