AnsweredAssumed Answered

slow SD card

Question asked by Jan Malý on Aug 28, 2017
Latest reply on Sep 4, 2017 by Jan Malý

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

Outcomes