Question about SdFat-Beta

Status
Not open for further replies.

OJGV24

New member
Good day lovely comunity,

I am sure my question is very simple for some of you, I just wanted to get it out of my head.

I have just started using my Teensy 3.5 and I wanted to save some data into my SD. I also found that Teensy has a faster library (SdFat-beta) so I wanted to test it.

Here is what I want and what I am doing:

I want to write to a file every 20 ms and I want to use the less time possible (to write), so I want to avoid using commands like file.flush() or file.close() until I confirm that I want to stop recording data. However, I am concerned if I don't flush or close, there will be memory leakage.

I made a test code where I am succesfully writing a "message" of a little bit more than 100 bytes (which represents say my data) in less than 100 microseconds. This process maintains fairly stable for 10000 loop iterations with occassional "hangs" between 5-10 ms (5 in 10000, 4 at the very first 10 iterations). My message is stored in a char message[] variable before entering the loop so I am assuming that it is a global variable that consumes some RAM. What I am looking to test here is wheather this message suffers from leakage but I don't know if this is a correct way of checking that. After the 10000 iterations are finished, I open up the file to check if my message is correctly stored all the 10000 times, and it is.

Can anyone confirm if this will not leak? I am not worried about losing the data if the power goes down. I just want the fastest way while power is up and to close the file at the end.

I know I could do something like flush every 500 iterations but I would prefer avoiding it since I don't want the data to suffer from 30-80 ms hangs. Anything that ENSURES me that the data will be written in less the 5 ms CONSTANTLY is acceptable.

I have attached the code. To use it just upload it with your SD Card on, send a 1 to write the "message" and let it run. When it stops, send a 2 to verify the message. Please remember to use the SdFat-beta library given here (https://github.com/greiman/SdFat-beta). To use it I copied the folder SdFat to the C:\Program Files (x86)\Arduino\libraries folder

Thanks in advance.
 

Attachments

  • FastSDWrite.ino
    3.2 KB · Views: 80
Last edited:
Status
Not open for further replies.
Back
Top