I am using the DMA on sports 0 and 1 for RX and TX of data configured for TDM multichannel mode.
I have set up a 2-D array for tx and rx of data. x_count=dma buf window size( words) x_modify = 2, Y_modify=2, Y_count = 2;
am using 16 bit audio data sampled at 48kHz.
I am having a problem where the buffer data is getting out of sync, it appears I am either reading/or writing too the wrong Y index of the 2-d array causing my data to be swapped (its audio data so a clean sine wave ends up getting a 24 kHz carrier on the output like I am reading a new then old sample; or writing over newer sample
I tried using an alternating y index value (0 or 1) and I am getting data issue above.
I tried to read DMAx_CURR_Y_COUNT to determine the correct buffer Y index to select in the 2D array but it does not work correctly I see the index changing in ice tool but when reading it I seem to almost always get the same index value (> 99% of time). so always selecting from the same Y index location.
anyone else had similar issue or have a suggestion on best mechanism to reliably get the not currently active buffer to read from/write too?