ADC DAC Playback ping pong buffer problem after breakpoint

Hi All,

I'm using the adc_dac_playback example on the EZ-589 kit.

The only thing I changed in the code is replace the line "if ((AdcCount >CALLBACK_COUNT) || (DacCount >CALLBACK_COUNT))" by a "if(0)" line to make the code run for a longer time.

Now, if I stop the code using a breakpoint, or pressing the pause button, and restart it afterwards, the output buffer is distorted in half of the cases.

I have traced the problem to the point that probably the synchronisation in the ping-pong system goes wrong, so the buffer that is submit in the callback function is actually the buffer that is used to fill the data from the sport.  This is a guess because there is no way to know what buffers are used at a certain point or if buffers are filled or not if a callback is registered.  Also stop the I/O DMA in the target settings doesn't solve this synchronisation problem.

How can I fix this, and be sure the synchronisation is OK after a breakpoint ?

If this cannot be solved, how can I use the drivers in debug mode ?

Best regards,

Thierry

    •  Analog Employees 
    on Mar 8, 2016 10:33 AM

    Hi Thierry,

    The issue you are describing is a classic problem that everyone face with a real-time setup. Ping pong buffers will loose synchronization because of breakpoints. I don't think there is a way around it (at least, I am not aware of any).

    May be sending out some debug information through UART might be helpful in this case .printf or fprintf are not useful as  they cause issues in real time frame work by halting DSP in between.

    Thanks,
    Sachin