cancel
Showing results for 
Search instead for 
Did you mean: 

How to store sensor data?

PSzyr.1
Associate

Hello, I use STM32WL55 board. Now every data that I get from sensor is sent immediately. I want to accumulate data for five minutes and then send in bulk all every five minutes. I have problmes to save the data succesfully, how can I do it that microcontroller saves data and send it all in intervall. Any suggestion how to start or where to research please? Thank you

3 REPLIES 3
TDK
Guru

How much data is it? There is a decent amount of RAM available. Create a global storage buffer and store it in there.

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

RAM buffer if it fits. Look for circular buffer, head, tail pointers, etc.

For flash... hmm. Same concept as circular buffer, except you need multiple buffers. Each requires its own set of pointers.

In RAM, you can use two buffers, or ping pong) for writing to flash. Sensor data is added to either ping or pong and once filled, swap to the other and flag the need to write the full RAM buffer to flash tail pointer.

Reading from flash uses the head pointer. Once you've read everything, set head = tail.

Just a thought.

EXUE.2
ST Employee

it depend on the quantity of data you want to save, there are 3 common method:

  1. save data to RAM if the capacity of RAM is enough;
  2. save data to flash if the capacity of flash is enough;
  3. save data to external EEPROM.