I'm collecting data from an AD345 accelerometer with a 32 scan buffer using an interrupt to get 16 scans at a time, which are then written to SD card using the SDFile System and FAT library. AT 200 scans/sec I need to repond to an interrupt within <120 mSec at worst, or I loose data. I am logging the SD write time of (fprintf( sd,.... ) by displaying average and max write times for every 10 seconds to the serial port. I write in about 300 byte chunks for every 16 scans - a total of about 4K bytes/sec. I get some very short write times because of software buffering in the SD software to support 512 byte blocks(?). Average values are consistently around 3-4mSec. But I still get big variations, max values alternate between about 7mSec and 107 mSec every 10 secs ( on the run I'm watching now) so presumably something in the SD card is blocking data at ?64Kbytes? and taking time to open a new block?
I guess that mostly the SD card just swallows data, but occasionally says hang on a mo while I mess with my internal arrangements before I accept more data?
My questions; Can anyone throw any light on this - and ways to speed things up? In particular, the SD write code seems to mask my interrupt, so I can't get a response to my interrupt while the disk is writing. Can I make a way for the long writes to be interrupted? Has anyone fiddled with SDFileSystem to do this?
Has anyone measured write times for different SD cards? While watching this, the times dropped to max values of 6 and 30 per 10 secs for about 10 minutes and then went back to 7 /117. Changing SD card got Max values alternating between 20 and 30 mSec. Both cards alternate between hi and lo max values at the same rate. The average values are always very low - around 3 - 4mSec. Too much variablility for comfort!
Tim Owen
I'm collecting data from an AD345 accelerometer with a 32 scan buffer using an interrupt to get 16 scans at a time, which are then written to SD card using the SDFile System and FAT library. AT 200 scans/sec I need to repond to an interrupt within <120 mSec at worst, or I loose data. I am logging the SD write time of (fprintf( sd,.... ) by displaying average and max write times for every 10 seconds to the serial port. I write in about 300 byte chunks for every 16 scans - a total of about 4K bytes/sec. I get some very short write times because of software buffering in the SD software to support 512 byte blocks(?). Average values are consistently around 3-4mSec. But I still get big variations, max values alternate between about 7mSec and 107 mSec every 10 secs ( on the run I'm watching now) so presumably something in the SD card is blocking data at ?64Kbytes? and taking time to open a new block?
I guess that mostly the SD card just swallows data, but occasionally says hang on a mo while I mess with my internal arrangements before I accept more data?
My questions; Can anyone throw any light on this - and ways to speed things up? In particular, the SD write code seems to mask my interrupt, so I can't get a response to my interrupt while the disk is writing. Can I make a way for the long writes to be interrupted? Has anyone fiddled with SDFileSystem to do this?
Has anyone measured write times for different SD cards? While watching this, the times dropped to max values of 6 and 30 per 10 secs for about 10 minutes and then went back to 7 /117. Changing SD card got Max values alternating between 20 and 30 mSec. Both cards alternate between hi and lo max values at the same rate. The average values are always very low - around 3 - 4mSec. Too much variablility for comfort!
Tim Owen