4

I'm trying to develop a datalogger on a Cortex M0 (LPC11U14), and I was thinking of using a real-time OS like FreeRTOS, so that I can have one low-priority task that writes the data to SD, and multiple higher-priority timers that fetch the sensor data.

Does anyone know of any code examples that can serve as a reference design? I know how to create tasks/timers, but I'm interested in efficient ways to pass the data from the timers to the write-task. And I'm hestitant to re-invent the wheel, if there already exists a good datalogger project which can serve as a codebase?

Heeryu
  • 852
  • 10
  • 25
Maestro
  • 9,046
  • 15
  • 83
  • 116

1 Answers1

1

I suggest you to use a Queue to serialize data logging.

Having a low priority task that waits on the queue and writes to sdcard when something arrives and some other tasks that write sensor data to the queue would accomplish what you want elegantly.

Take a look : FreeRTOS Queue Management

Specially:

  1. xQueueCreate
  2. xQueueSend or xQueueSendFromISR
  3. xQueueReceive
Heeryu
  • 852
  • 10
  • 25