I have a K70-based project with the SGTL5000. The project is running MQX4.1. WAV files are stored on an eMMC and played on command from a user interface. The code was lifted from the audio demo code for the TWR-AUDIO-SGTL module. Most of the time the audio plays with no problem. But sometimes the K70 stops and a small buffer of audio data repeats forever. Sometimes CW10.6/PEMicro Multilink FX can catch it. Most of the time I can pause CW and look at the task info. I have noticed that my audio task is always stuck in an ioctl() call into the sai dma driver (sai_dma_dsai.c) and it's blocked waiting on an empty buffer semaphore that is supposed to be posted from the ISR.
case IO_IOCTL_I2S_WAIT_TX_EVENT: _lwsem_wait(&stats->BUFFER_EMPTY); break;
Is it possible for this driver to miss an interrupt?
I suspect a race condition somewhere because I have seen the system play the same file 300 times with no problem with the following sequence:
1. open file
2. open sai:
3 play file
4 close file
5 close sai:
Then I stopped CW and downloaded the same firmware and started again and the the file plays a random number of times before the system hangs.