Flash-chip database driver for the Teensy (meet TeensyDB)

KrisKasprzak

Well-known member
For the last 2 years, I've switched from SD cards to flash chips for storing telemetry data. I wrote a what I feel is a robust database driver where data is stored as records of fields. Just like DBase III, and Microsoft access. My needs are to take measured data, save it and not be concerned if the MCU loses power or if an SD card shakes loose--my telemetry system is in a very volatile environment. The standard database operation of open / write / close every read became a huge performance hit for any library based on a FAT table. This library can store approx. 50 bytes per millisecond and since there is no formal close process, there is no loss of data if power is suddenly lost. The driver can store up to 255 fields of popular datatypes such as byte uint8_t, float, double, fixed char. Note: the default field count is 20 but see the .h to adjust. Because fields are of known type and size, this library is NOT to be used to store images, audio files, or random types of data.

The include example shows how to create fields, save data, read and display data to the serial monitor, and even read and write to an SD card.

This library has been tested with a combination of
MCU
  1. Teensy 3.2
  2. Teensy 4.0
Flash Chips
  1. Microchip SST25F040C
  2. Winbond 25Q64JVSIQ

To date, I've had great success never losing 1 bit, so I've decided to make this library public for others to use.

Repository

How to implement


Enjoy!
 
@KrisKasprzak
Morning Kris - amazing. First - dbIII - argh was using that at work for years before retiring - brings back memories or nightmares depending.

Second - great work have a several FLASH (NOR and NAND) from LittleFS days. Also been playing with SDRAM (yes I know but might be interesitng to test with).

Third - great work on the library and love your videos always instructional.
 
Back
Top