Comments (6)
You will never log to an SD at 1,000 Hz with this simple approach.
The long write times are when an actual SD block is written.
SD cards have 512 byte blocks and can take a very long time to write. Often it will be much longer. If a cluster must be added to the file, the FAT must be read and a cluster found. Two copies of the FAT must be updated.
The SD card can have occasional long write latency. It must erase large blocks of flash. It may pause to move data and remap flash for wear leveling. This will take many ms.
Here is a program, LowLatencyLoggerADXL345 that logs data from an ADXL345 at 500 Hz. It requires shared SPI and a high quality SD.
LowLatencyLoggerADXL345 appears to work at 1,000 Hz but may be marginal.
You could use software SPI on the ADXL345 and buffer data for writing in loop. You would need to buffer about 100 ms of data which would require 600 bytes.
from sdfat.
Hey!
Thank you very much for your help!
I will try this example. But I have one question. I also need to use a nRF24L01+ module to transmit data, which is working fine with ADXL345 using hardware SPI. Is it possible to use software SPI on the microSD module with this example? Or is it better to use hardware SPI on the microSD and software SPI on the ADXL345 and nRF24L01+?
Thank you very much!
from sdfat.
I can't help you. The nRF24L01+ will fail if a TimerOne interrupt occurs while the nRF24L01+ is active.
I don't think you should try the LowLatencyLogger example if you want to add access to the nRF24L01+ while logging.
You are on your own. I don't want to waste my time trying to solve this problem using Arduino.
I would use an STM32 board with the ChibiOS/RT RTOS, not Arduino. Even low cost STM32 boards have two or three hardware SPI ports. The priority based preemptive scheduling of threads in ChibiOS/RT makse it easy to solve problems like this.
Good luck.
from sdfat.
Hey!
Just a short question, I don´t want you to waste your time.
I´m looking for a microSD module compatible with other SPI devices, i.e. which doesn´t hold the MISO line hostage. Could you tell me wich microSD module did you use for testing LowLatencyLoggerADXL345 or any other that I can use?
Thank you very much.
from sdfat.
I used an old Adafruit microsSD module. I have some older ebay modules that are OK.
Now most ebay modules are clones of the flawed Catalex MicroSD Card Adapter or the LC studio module without level shifters
The Adafruit module is more expensive, $7.50.
You may be interested in a test I did with an old TimerOne based program.
I use software SPI with an ADXL345. See my ADXL345 driver in UserFunctions.cpp to define pins.
I have logged data directly to a csv file at 2,000 Hz with SdFat and at 4,000 with SdFatEX.
I have attached the program. It is not polished since it is my test program. It uses the current version of SdFat-beta.
from sdfat.
Hey!
Thank you for your answer. Now I´m not using TimerOne library. I have followed your program LowLatencyLoggerADXL345 and I have edited it, so now I can log data during the time that I set into a variable and then I can send it to a raspberry using nRF24L01+. It´s working fine, the problem is that I´m using software SPI on the microSD and I can only get a frecuency of 200 Hz because if I try with higher frequency it says "Rate too fast". For this reason I´m going to buy the Adafruit microsSD module so I can use the hardware SPI on the three modules and I can get a frequency of 1000 Hz. I hope it will work.
Thank you very much!
from sdfat.
Related Issues (20)
- Refresh SD-Card !!! HOT 5
- Help needed with accessing files from SD flash from both the cores in esp32 HOT 2
- STM32L452 SPI2 port assignation not working HOT 17
- How to modify the timestamp of a folder1 HOT 2
- Get the full path or directory name of a File HOT 4
- Contribution, ESP32 + SdFat Recipe
- USB HOST SHIELD, USB Flash Drive support HOT 106
- SdFat SDIO on RP2040 with USB stick support HOT 5
- STM32duino and SdFat HOT 14
- Questions about file opening mode a+ HOT 2
- Sdfat on stm32 if sd card removed stm32 crash HOT 22
- SDFAT compatibility with Arduino Giga HOT 1
- ExFatLogger vs LowLatencyLogger different behaviour HOT 7
- Running two SdCards are not working HOT 2
- addApbChangeCallback(): duplicate func when using with TFT_eSPI HOT 5
- Problems with Teensy 4.0 and Adafruit XTSD with SdFat. HOT 2
- [question]How to speed up sd writes on Arduino Uno r4? HOT 7
- Examples of SDFat HOT 4
- sdfat does one write to sd and then nothing HOT 1
- SdFat recommended usage for long term data logging HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sdfat.