cancel
Showing results for 
Search instead for 
Did you mean: 

Saving values from different sources into an SD CARD

ALope.1
Associate II

Hello,

I'm getting values from an ADC an ACC, and a microphone. The ACC and ADC are in continuous acquiring mode but with different sampling rates. The microphone is turned on after a random trigger in time, basically the microphone record data for 1 second (at 48kHz) and then stops.

I need to save all the values into an SD Card without losing the time perception of when the signals were acquired.

What are the best practices to save values in SD CARD without losing the synchronization between them? Maybe I need to write values in structure data?

I hope someone can guide me with this topic!

Thank you in advance!

2 REPLIES 2
TDK
Guru

You'll need to add some sort of structure to be able to know how to interpret the data, especially if it's not uniform data since the microphone burst is random.

You could add a header before each data.

uint8_t identifier;

uint16_t length;

then a bunch of uint8_t data.

then identifier 0 is ACC, 1 is ADC, 2 is microphone. Might also want to include a timestamp or time since reset. Something like that. Could also do different files for each type of data.

If you feel a post has answered your question, please click "Accept as Solution".

Have a single thread manage the stream to the card.

Have some way to interleave or mux the data.

Look at RIFF, encapsulate with timestamp so data can be reconstructed.

Try using a packet format that spills data in some multiple of the sector or cluster, ie 512 bytes, 8KB, 32KB, etc.

Large aligned writes will be the most efficient.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..