Hello!
I have written a program that takes audio samples from the Audio shield and writes them onto the build-in SD card on a Teensy 4.1.
Everything runs perfect if the executing instance is "loop()". If I let the recording&writing function to be executed by a thread ("TeensyThreads.h") I run more or less often into a situation where the SD card "flush()" does not return.
I debugged it down to
while (!(SDHC_IRQSTAT & SDHC_IRQSTAT_TC)) { } // wait for transfer to complete
from file "NXP_SDHC.cpp" which runs endlessly. Obviously waiting for the transfer complete flag which stays unset.
Is this a known issue? Does anybody made a similar experience?
Does it really have to do with threads or is this just a coincidence? (I tested it for more than 100.000 times...)
Uwe
I have written a program that takes audio samples from the Audio shield and writes them onto the build-in SD card on a Teensy 4.1.
Everything runs perfect if the executing instance is "loop()". If I let the recording&writing function to be executed by a thread ("TeensyThreads.h") I run more or less often into a situation where the SD card "flush()" does not return.
I debugged it down to
while (!(SDHC_IRQSTAT & SDHC_IRQSTAT_TC)) { } // wait for transfer to complete
from file "NXP_SDHC.cpp" which runs endlessly. Obviously waiting for the transfer complete flag which stays unset.
Is this a known issue? Does anybody made a similar experience?
Does it really have to do with threads or is this just a coincidence? (I tested it for more than 100.000 times...)
Uwe