T4.1 SD hard reset?

TeensyDigital

Well-known member
I've got a data logger solution, based on the T4.1 that is used in an amateur rocket. The application also has a high powered radio that transmits telemetry. This weekend on a launch, I had my first issue where the SD logging failed mid flight. The SD logging is running on a separate thread, so only the logging was affected.

Back on the bench, I am able to recreate the intermittent failure by increasing my radio transmit frequency and antenna position, relative to the board. So, I am reasonably sure that the issue is RF interference that is causing the onboard SD to glitch and then hang. It is also possible that the G forces or vibration of a launch could cause the SD card writes to glitch and hang, but that is harder to reproduce. I've launched with this solution at least a dozen times with no previous issues.

Since I can recreate the issue reliably, I have been trying to figure out a way to recover from the issue if it happens again. I have a whole different effort going to better shield and fix the root cause, but preventing all possible issues related to the physical card (vibration, etc) is going to be tough, so I'd like to be able to recover.

In my testing, I added a watchdog like timestamp to the logging thread. If the main thread sees that the logging thread is hung (no updates in 1000ms) then it can launch a new thread, but it seems like it is the SD library that is hose. The millisecond the new thread tries to do anything with the SD library it also hangs. I am using the standard SD library.

I cannot find a way to reset the standard SD library to try and recover. Other versions of the SD library have a SD.end() or other methods to recover if an SD card is pulled out. Does anyone have any suggestions on how to reset or recover the SD library if it hangs?
 
Back
Top