Go Down

Topic: Need read/write times for SD lib to be faster (Read 4016 times) previous topic - next topic

PaulS

Quote
The problem I have is writing to the micro SD. I'd like to be able to write the data at a rate of about 200Hz.

Two bytes at 200Hz or 2Kb at 200Hz. Frequency alone is a useless value.

fat16lib

mokwichi,

You will need special buffering to log at 200 samples/sec.  I have posted a number of examples here http://code.google.com/p/beta-lib/downloads/list.

The examples in fastLoggerBeta20110802.zip use custom timer ISRs and buffering.

The examples in ChibiOS20111027.zip and FreeRTOS20111031.zip use a real-time kernel to run two threads. One thread reads sensors at fixed time intervals and puts the data in a circular buffer.  The second thread removes data from the buffer and writes it to the SD.

You will need enough programming skill to modify these examples for your use.

Constantin

#17
Dec 02, 2011, 06:33 pm Last Edit: Dec 02, 2011, 06:36 pm by Constantin Reason: 1
Another approach is to use two arduinos. Use one for the data gathering and massaging, the second to do all the other work (i.e. writing to disk, etc.). I'm sampling power at 2.8ksps with a 328P @ 16MHz, the second chip (1284P) does the SPI work with the SD card as well as a RFM-12B. The two talk via serial, using EasyTransfer. I selected this approach to minimize the possibility of data getting lost while the 12B was transmitting, for example (it requires an interrupt).

A dedicated chip may also be an answer. For example, the specifications of a ADE7753 are tasty for power measurements, I just never got it to work properly. You might be able to find similar dedicated chips for sampling for your applications that can be addressed over I2C or SPI.

sbright33

@fat16lib - Can I use your WaveRP library with this hardware?

http://www.ladyada.net/products/microsd/
I don't have the Wave Shield.
Where do I modify chipSelect like in the above tutorial?
Mine is not the default wiring.

I have built a mic preamp which works using analog input.
So I can record.
I could not play the files?
What do I need to change in the WaveRecordPlay example sketch?
What options can I change in that code?
What's the difference between SD and SDfat libraries?
If you fall... I'll be there for you!
-Floor

Skype Brighteyes3333
(262) 696-9619

sbright33

The author says no changes are necessary.  Can anyone verify this?
My chipSelect pin is not the default...
If you fall... I'll be there for you!
-Floor

Skype Brighteyes3333
(262) 696-9619

Go Up