9 years, 4 months ago.

[LPC1768] LocalFileSystem for Logging with RTOS

Hi! I want to develop a flight controller for model airplanes based on LPC1768. The RTOS is cool for handling many modules, when they have to "run in parallel". For example an ISR-driven buffered I2C-Interface can be used in a sensor reading thread. In the thread, the "read" commands seem to block. But the time, when the hardware interface is working and the thread waits for the sent-interrupt, can be used by other threads. The thread priotiy system is a nice addition here.

For the base framework I need Logging. The "LocalFileSystem" would be great, even for config files, etc. But the Handbook says: "•File access calls (fread, fwrite) will block, including interrupts, as semihosting is effectively a debug breakpoint"

That is Ok for initializing the program, but for Logging? My first tries caused the servos to jitter (timed interrupts don't work) and in bad communication (lost gps packets). It is unusable in real flights.

Is there a way to do file access operations more "in background"? It would be cool to use the frwite function buffered.

1 Answer

9 years, 4 months ago.

I think your best bet would be to use something like the SDFileSystem to store data on a SD card (or some other library which can store data on an external storage medium.) LocalFileSystem will never be ideal for your purpose as you have already discovered. If there were times where you could take a blocking LocalFileSystem operation, then I guess you could manually buffer the data in RAM and only write to the LocalFileSystem at those times. However it doesn't sound like that is likely to work for your purposes.

Accepted Answer

Ok, a sd card (or usb flash drive) is more "black box" like. ^^

posted by BlazeX . 09 Dec 2014