I’m reaching out for some advice on an issue that’s been troubling me for the past three weeks. I’ve designed a custom breakout PCB for a Teensy 4.0 that logs basic sensor data (accelerometer, gyroscope, and barometer), with a Kalman filter to a microSD card. The setup logs data at a rate of 5 samples per second, and it is stored in a .dat file. To monitor the main loop, I have a non-blocking blink function that ensures the loop is running without delays.
The Problem: After around 20 minutes of continuous operation, the main loop slows down significantly, making the logging process almost unusable. This issue only occurs when the logging function is active. If I comment out the function responsible for data logging, the loop runs smoothly for extended periods without any slowdown.
The microSD card is connected to the Teensy via SPI mode. I’ve included an image of the schematic for reference.
What I’ve Tried:
The Problem: After around 20 minutes of continuous operation, the main loop slows down significantly, making the logging process almost unusable. This issue only occurs when the logging function is active. If I comment out the function responsible for data logging, the loop runs smoothly for extended periods without any slowdown.
The microSD card is connected to the Teensy via SPI mode. I’ve included an image of the schematic for reference.
What I’ve Tried:
- Monitoring the system performance without the logging function—no slowdown occurs.
- Adjusting the sampling rate and other minor tweaks with no success.
- Adding a heatsink on the Teensy processor to dissipate heat, but didn't make a difference.