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
  • One thing has dropped out
    I found some functions in retarget.c file in flashfs sample code(and RTA_agent mode), I'm using COM0 and printf as a serial communication.

    Do they have any effect on my problem or not?

    I know functions of stdio.h should retarget on special function such as putchhar and ... but here when we have two destination 1.serial port 2.file system .... are they compatible in a same place and project(I think yes because except fflush all functions are properly working, but I think fflush need to has some manipulation in retarget method)

    If anybody could help me I'll appreciate him.

    thanks in advance

Reply
  • One thing has dropped out
    I found some functions in retarget.c file in flashfs sample code(and RTA_agent mode), I'm using COM0 and printf as a serial communication.

    Do they have any effect on my problem or not?

    I know functions of stdio.h should retarget on special function such as putchhar and ... but here when we have two destination 1.serial port 2.file system .... are they compatible in a same place and project(I think yes because except fflush all functions are properly working, but I think fflush need to has some manipulation in retarget method)

    If anybody could help me I'll appreciate him.

    thanks in advance

Children
  • 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

  • Hi
    I have the same problem .. there is nobody to say something???