Hello,
can you help me, please? The procve catch the messages on Can0 and Can1 and these message are saved in buffer. Then this buffer is copied to SD card. The problem is, that writing on the sd card is too slow. I use SD class 10.
The function is:
void Write_message()
{
//byte 0
str_file[0] = HEX[sd_zaznamy[cislo].data[0]/16] ;
str_file[1] = HEX[sd_zaznamy[cislo].data[0]%16] ;
str_file[2] = ' ';
//byte 1
str_file[3] = HEX[sd_zaznamy[cislo].data[1]/16] ;
str_file[4] = HEX[sd_zaznamy[cislo].data[1]%16] ;
str_file[5] = ' ';
//byte 2
str_file[6] = HEX[sd_zaznamy[cislo].data[2]/16] ;
str_file[7] = HEX[sd_zaznamy[cislo].data[2]%16] ;
str_file[8] = ' ';
//byte 3
str_file[9] = HEX[sd_zaznamy[cislo].data[3]/16] ;
str_file[10] = HEX[sd_zaznamy[cislo].data[3]%16] ;
str_file[11] = ' ';
//byte 4
str_file[12] = HEX[sd_zaznamy[cislo].data[4]/16] ;
str_file[13] = HEX[sd_zaznamy[cislo].data[4]%16] ;
str_file[14] = ' ';
//byte 5
str_file[15] = HEX[sd_zaznamy[cislo].data[5]/16] ;
str_file[16] = HEX[sd_zaznamy[cislo].data[5]%16] ;
str_file[17] = ' ';
//byte 6
str_file[18] = HEX[sd_zaznamy[cislo].data[6]/16] ;
str_file[19] = HEX[sd_zaznamy[cislo].data[6]%16] ;
str_file[20] = ' ';
//byte 7
str_file[21] = HEX[sd_zaznamy[cislo].data[7]/16] ;
str_file[22] = HEX[sd_zaznamy[cislo].data[7]%16] ;
str_file[23] = '\n'; f_write(&Fil, str_file, 24, &bw);
//f_sync(&Fil);
cislo_zpravy++;
return;
}
The problem is in the function f_write. For very fast process is this function too slow. We need to write on the card every 10ms about 10-20messages.
Can somebody help me, how can I write on sd card very fast?
Thank you
RAM Buffer + Background Block Write
Suggest you to create a thread exclusively for disk I/O, like any mainstream OS...
thank you for your email...
I have a buffer and background writing...the message are very fast 10ms...
I cant do a thread, because of I am not using freertos...
I don't know a reason this problem...
Hi Jan,
How are you configuring the SD/MMC module? I would recommend you to use the periph_sdmmc example that comes with LPCOpen as base for your application. Also, is there another process that might be slowing the write function? If you disable the other modules and only perform the write is it the same performance?
Hope it helps!
Best Regards,
Carlos Mendoza
Technical Support Engineer
hello,
yes,i have configured it as this example.i try to change the priorities,and
without good result.I have only can and mmc card.The can messages have 10ms
frequency.It is too fast for this procesor?I dont have any idea...the
writing runs about 20sec good and then is full buffer,and then 10sec it is
good...the buffer full every some time,because procesor is slow in writing
on sd card...
thank you
Now, I am using RAM buffer and block writing. It is the same problem. It is not solution.
For a thread I need freertos...and it means whole program change...