2015-10-28 06:20 AM
Hi,
I am working with a STM32 data logger with a pulse counter, SPI accelerometer and ADC connected. I am puzzled: how can I design a common 4/8Kb buffer for time-synchronous sensor values for later SDIO SDcard storage? Like, with the timestamp value, it'll store all three sensor values together. I request some guidance.
Thanks in advance.
2015-10-28 06:29 AM
Assuming you want to use the C language, have you heard of the
struct
keyword ? Like here :https://en.wikipedia.org/wiki/Struct_%28C_programming_language%29
You can define an array of such struct items as buffer for your data.2015-10-28 07:55 AM
Is the data collected from the sensors with different or similar rates? Do the different ratios suggest a good packing multiple?
You can write 4/8K blocks, and still have smaller structures, you just have to buffer them and manage the writing to get the optimal throughput. Why can't you think about how you want to arrange the data? How would other things do it, how do you plan on processing it? Would ASCII line records, like .CSV, be the most suitable for input into other tools? Would a compact binary format be easier to process later, and use space more efficiently?2015-10-28 09:38 AM
Thanks, .csv format is ok, I guess. Sensors are giving data at different rates like 5ms, 10ms and 100ms. How to buffer them? I request some more guidelines.
Thanks in advance.2015-10-28 10:44 AM
You'd store data in sufficiently large arrays, and accumulate blocks of data.
Perhaps this is something you need to discuss with colleagues or project supervisors, this all comes down to basic data and structure management, something that a CS program should cover. Speak to the people that are going to use the device, and what their expectations, and processing requirements are. I think there is a line here between ''guiding'' and actually doing the work/studying for you, and I'm not keen to doing the latter.2015-10-28 12:02 PM
Got it, Thank you.