Fastest way to store data to SD card?

25 May 2012

I want to store data received from ethernet to SD card continuously in a Thread. May I know what is the best way to do this?

I am using mBed RTOS.

void EthernetReceive_Thread() { receive data from ethernet and put it into Message Queue

}

void DataStorage_Thread() { fopen(SDCard,......"File.txt");

while(1) { Take data from messageQueue and put it to File.txt

if(time spent == 10 mins) { fclose(); }

}

}

main() { .... .....

.....

Start EthernetReceive_Thread Start DataStorage_Thread

while(1) { Display message on LCD

}

}

Here there will be 3 threads running at a time. 1. Ethernet receive 2. Data Storage 3. LCD display (while loop in main() )

May I know what is the best and fastest way to store the data to SD card without losing data? Now I could achieve around 20Hz, but is it possible to store data at 100HZ????????

I am not using fopen and fclose everytime which makes the data storage slow. But the problem is, if mBed is powered OFF before 10mins, then fclose will not run and data will be lost. So I need atleast 1 sec power backup after mBed main power is OFF.

The processor clock speed is changed to 100MHz from here : http://mbed.org/forum/mbed/post/8566/