This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

fflush doesn't work on LPC23xx

Hi
I have problem on fflush in rl-arm4.13.

fflush doesn't work at all and always zero is result of this function. no data will save on SD card after this function.

but fclose works well.

another problem is about maximum size of file in FAT32, I know it is 0xFFFFFFFF or 4GB byte but with flashFS when the program exceed this size in 1 file there is no any error and continue everything
And in my PC I could see the used memory space in this situation for example is more that 4GB but I have one file which is 4GB in size and it's crashed

Indeed I'm using 16GB SDHC transcend Class10

my code is very simple such as below:

while (1){
if (ferror(f)) break;
fwrite (&buf[0], 1, BUF_SIZE, f);
if (fflush(f)) break;
}
fclose(f);
printf("error has been accured\r\n");

what shall I do?
please help me

thanks

Parents
  • Hi

    Nobody is here ...

    I don't know what's going with SD card

    I think FAT table will update by fflush but header file in present directory wont be updated because used memory space will changed but file size is always equal to zero till file be closed.

    I have wrote such a way:

    ...
    file_to_close++;
    if (file_to_close == file_savior){
            fclose(ff);
            ff = fopen (fname, "a");
            fseek(ff,0,SEEK_END);
            file_to_close=0;
    }
    ...
    

    but here is another problem

    when the file size be great MCU will be slower than the first. for example its speed is about 1.5MBps at the beginning but after 1GB it's about 700KBps

    please help me

Reply
  • Hi

    Nobody is here ...

    I don't know what's going with SD card

    I think FAT table will update by fflush but header file in present directory wont be updated because used memory space will changed but file size is always equal to zero till file be closed.

    I have wrote such a way:

    ...
    file_to_close++;
    if (file_to_close == file_savior){
            fclose(ff);
            ff = fopen (fname, "a");
            fseek(ff,0,SEEK_END);
            file_to_close=0;
    }
    ...
    

    but here is another problem

    when the file size be great MCU will be slower than the first. for example its speed is about 1.5MBps at the beginning but after 1GB it's about 700KBps

    please help me

Children