Audio data corrupted/shifted

Hello,

I'm developing an audio application for the ADSP-SC573 processor and I'm using the SC573-EZLITE kit as development hardware. I'm trying to use the ADC DAC Audio Playback (SC573 SHARC) example as a starting point and have created my own test project based on that. I'm experiencing some data corruption when the audio should come through as unchanged. It seems that there is some synchronization issue somewhere, but I have not been able to entirely pinpoint the problem.

I'm able to reproduce some of the problems on the original example code when it is suspended and then resumed. The example code seems to start reliably, and the output audio is correct, but after a suspend and resume, parts of the audio stream are shifted:

ch1: input, ch2: output

In my altered code where I'm running the processing on core0 (arm) only, the situation is worse. When starting as debugged the output is rarely correct, and the shifted part length changes from single sample to a short block of data. When doing a suspend-resume cycle the situation may be corrected or it can get worse. I also tried to load the software to the external flash using cldp.exe to see if cold starting makes and difference but result was the same.

I'm not sure what happens but it seems that the buffer halves of the ping pong buffer get mixed and the DMA starts writing or reading the half that is manipulated by the ProcessBuffers function. If I understand correctly the callback functions should always receive addresses to the buffer position that are ready to be read or written? How could this go wrong?

The initializations on the two software should be the same. Is there anything that can be done to ensure the DMAs and buffers are synchronized at start up?

Best regards
Pauli