Hello everybody,
for my Master's Thesis, I am currently trying to implement a system which needs to log the data of five analog sensors with relatively high frequency (100-1000Hz logging frequency is desired).
For this project, I took a very big step out of my comfort zone going from exclusively using arduinos and building sketches with a handful of functions in the arduino IDE to using a Teensy 4.1 using the Platformio IDE and using custom includes etc. to implement the needed functionality. My understanding of programming and embedded systems is extremely limited, so please bear with me if I sound like a numb nut at times.
From my research up until this point, I determined that due to speed limitations, the regular SD.h library is not suitable for the job and that SdFat.h is a better choice, eventhough many people seemed to have issued using the T4.1 with SdFat.
I successfully implemented a couple of example projects in Platformio using the SdFat.h library and ran the ExFatFormatter sketch, the bench sketch and the TeensySdioDemo sketch successfully. I did not make any modifications to the source code in any of the example sketches. I am using the build-in SD slot of the T4.1 and a 16gig SanDisk SDHC card. The results of the tests were as follows:
_____________________________________
Benchmark Sketch
Manufacturer ID: 0X3
OEM ID: SD
Product: SS16G
Version: 8.0
Serial number: 0XAB268B1D
Manufacturing date: 8/2013
FILE_SIZE_MB = 5
BUF_SIZE = 512 bytes
Starting write test, please wait.
write speed and latency
speed,max,min,avg
KB/Sec,usec,usec,usec
21276.60,5566,22,23
21834.06,5566,22,23
Starting read test, please wait.
read speed and latency
speed,max,min,avg
KB/Sec,usec,usec,usec
22727.27,23,22,22
22624.43,23,22,22
Done
Type any character to start
TeensySdioDemo
Type '1' for FIFO SDIO
'2' for DMA SDIO
'3' for Dedicated SPI
'4' for Shared SPI
FIFO SDIO mode.
size,write,read
bytes,KB/sec,KB/sec
512,16815.76,22367.59
1024,11265.47,13363.32
2048,7524.61,22446.12
4096,20170.98,22544.69
8192,13861.48,22491.74
16384,20215.95,22569.13
32768,19819.98,22565.55
totalMicros 7082517
yieldMicros 254330
yieldCalls 265
yieldMaxUsec 6060
Done
_____________________________________
Now, these numbers don't mean too much to me, I was primarily happy that the SD card was recognized and the reading and writing works. If anyone can see an issue with the results, I would be grateful to hear about it.
My question now is: Can somebody point me to an example of a simple data logger using the SdFat library that I can use for my give application? So far, I've been using the SD.h library and always used the most basic workflow of begin(), open(), write() and close(). The data logger examples in the sdfat library are overwhelmingly complicated for me and I'm not sure how to make enough sense of what's happening there to use their functionality for my project.
The closest I came were the TeensyDdioLogger from the SdFat-beta library (I am aware of the fact that SdFat and SdFat-beta are two different libraries and can not be used at the same time).
A much simpler example of (documented in German, I'm sorry) of an Arduino Datalogger with the SdFat library is this one here.
Essentially, I'm looking for something like this, but using a Teensy4.1 instead of an arduino board. Can someone give me a hint where to find an example for that? Or tell me, how I can determine which elements of the arduino example I need to change to make it work with the T4.1?
Many thanks in advance and sorry if it is a dumb question - again, I'm way out of my comfort zone here and after a handful of days worth of googling, I decided to reach out for help because my time is running out and I need to get the system up and running.
Cheers,
Thomas
for my Master's Thesis, I am currently trying to implement a system which needs to log the data of five analog sensors with relatively high frequency (100-1000Hz logging frequency is desired).
For this project, I took a very big step out of my comfort zone going from exclusively using arduinos and building sketches with a handful of functions in the arduino IDE to using a Teensy 4.1 using the Platformio IDE and using custom includes etc. to implement the needed functionality. My understanding of programming and embedded systems is extremely limited, so please bear with me if I sound like a numb nut at times.
From my research up until this point, I determined that due to speed limitations, the regular SD.h library is not suitable for the job and that SdFat.h is a better choice, eventhough many people seemed to have issued using the T4.1 with SdFat.
I successfully implemented a couple of example projects in Platformio using the SdFat.h library and ran the ExFatFormatter sketch, the bench sketch and the TeensySdioDemo sketch successfully. I did not make any modifications to the source code in any of the example sketches. I am using the build-in SD slot of the T4.1 and a 16gig SanDisk SDHC card. The results of the tests were as follows:
_____________________________________
Benchmark Sketch
Manufacturer ID: 0X3
OEM ID: SD
Product: SS16G
Version: 8.0
Serial number: 0XAB268B1D
Manufacturing date: 8/2013
FILE_SIZE_MB = 5
BUF_SIZE = 512 bytes
Starting write test, please wait.
write speed and latency
speed,max,min,avg
KB/Sec,usec,usec,usec
21276.60,5566,22,23
21834.06,5566,22,23
Starting read test, please wait.
read speed and latency
speed,max,min,avg
KB/Sec,usec,usec,usec
22727.27,23,22,22
22624.43,23,22,22
Done
Type any character to start
TeensySdioDemo
Type '1' for FIFO SDIO
'2' for DMA SDIO
'3' for Dedicated SPI
'4' for Shared SPI
FIFO SDIO mode.
size,write,read
bytes,KB/sec,KB/sec
512,16815.76,22367.59
1024,11265.47,13363.32
2048,7524.61,22446.12
4096,20170.98,22544.69
8192,13861.48,22491.74
16384,20215.95,22569.13
32768,19819.98,22565.55
totalMicros 7082517
yieldMicros 254330
yieldCalls 265
yieldMaxUsec 6060
Done
_____________________________________
Now, these numbers don't mean too much to me, I was primarily happy that the SD card was recognized and the reading and writing works. If anyone can see an issue with the results, I would be grateful to hear about it.
My question now is: Can somebody point me to an example of a simple data logger using the SdFat library that I can use for my give application? So far, I've been using the SD.h library and always used the most basic workflow of begin(), open(), write() and close(). The data logger examples in the sdfat library are overwhelmingly complicated for me and I'm not sure how to make enough sense of what's happening there to use their functionality for my project.
The closest I came were the TeensyDdioLogger from the SdFat-beta library (I am aware of the fact that SdFat and SdFat-beta are two different libraries and can not be used at the same time).
A much simpler example of (documented in German, I'm sorry) of an Arduino Datalogger with the SdFat library is this one here.
Essentially, I'm looking for something like this, but using a Teensy4.1 instead of an arduino board. Can someone give me a hint where to find an example for that? Or tell me, how I can determine which elements of the arduino example I need to change to make it work with the T4.1?
Many thanks in advance and sorry if it is a dumb question - again, I'm way out of my comfort zone here and after a handful of days worth of googling, I decided to reach out for help because my time is running out and I need to get the system up and running.
Cheers,
Thomas
Last edited: