F_write of fatfs: so slow

abcdcadb
Posts: 36
Joined: Mon Aug 07, 2017 1:28 am

F_write of fatfs: so slow

Postby abcdcadb » Mon Feb 26, 2018 11:08 am

I did a configuration on sd_card example:

Code: Select all

 int iOk,iCount;
FIL            iHandle;
f_unlink((const TCHAR*)"/demodir/r.txt");
iOk=f_open(&iHandle,(TCHAR*)"/demodir/r.txt",(BYTE)(FA_CREATE_NEW|FA_WRITE));
 gpio_pad_select_gpio(25);
    gpio_set_direction(25, GPIO_MODE_INPUT);
    gpio_set_pull_mode(25, GPIO_PULLUP_ONLY);
while(1)
{ 
//printf ("\niok is %d",iOk);
iOk =f_write(&iHandle,"1",1,(UINT*)&iCount);
//printf ("\niok is %d",iOk);
printf ("\niok is %d",iCount);
//vTaskDelay(1000 / portTICK_RATE_MS);
if(gpio_get_level(25) == 0) break;
}
iOk=f_close(&iHandle);
Using fatfs library instead of new_lib library to handle file. the code is very simple: continuously write down sd card until PIN_25 is grounded. I measured the duration of writing(by cell phone) is 6 secs, meanwhile the size of text file"r" in SD card is 8kB in other words, writing speed is lower than 2 kb/sec!!!!!!!!!

Any mistake i could improve?

jerome
Posts: 37
Joined: Wed Jan 23, 2019 2:28 pm

Re: F_write of fatfs: so slow

Postby jerome » Mon Mar 11, 2019 9:56 am

Hi
I'm facing the same issue, did you find a solution to this problem ?
Thanks
Jerome

Who is online

Users browsing this forum: Baidu [Spider], Google [Bot] and 66 guests