I have this code that will take in 8 bit samples via a SAR ADC then transfer it via DMA to the DFB Filter and then I have two DMAs, one requiring a HW request per burst and the other that does not so it double buffers them, transferring it to the SRAM.
My problem is that I am viewing data that either seems to have gaps in it, which is why I thought to double buffer the final filtered data, but this did not work. In fact I only achieved an even uglier signal. the pictures below are of the arrays the two DMAs transfer to. The First buffer always seems to have the data gap right in the beginning in the same place whenever I run it, while the second buffer seems to have substatially more gapping data, as well as the gaps change.
I don't know what I am doing wrong, below is the code for my DMAs.
For the first DMA I have
#define dma_out_A_BYTES_PER_BURST 2
#define dma_out_A_REQUEST_PER_BURST 1
#define dma_out_A_SRC_BASE (CYDEV_PERIPH_BASE)
#define dma_out_A_DST_BASE (CYDEV_SRAM_BASE)
dma_out_A_Chan = dma_out_A_DmaInitialize(dma_out_A_BYTES_PER_BURST, dma_out_A_REQUEST_PER_BURST,
dma_out_A_TD = CyDmaTdAllocate();
CyDmaTdSetConfiguration(dma_out_A_TD, LENGTH*2, /*DMA_END_CHAIN_TD*/ dma_out_A_TD, TD_INC_DST_ADR | dma_out_A__TD_TERMOUT_EN);
CyDmaTdSetAddress(dma_out_A_TD, LO16((uint32)Filter_HOLDAM_PTR), LO16((uint32)Filter_Ch_A));
Here is the code for the Second buffer
#define DMA_Buffer_BYTES_PER_BURST 2
#define DMA_Buffer_REQUEST_PER_BURST 0
#define DMA_Buffer_SRC_BASE (CYDEV_SRAM_BASE)
#define DMA_Buffer_DST_BASE (CYDEV_SRAM_BASE)
DMA_Buffer_Chan = DMA_Buffer_DmaInitialize(DMA_Buffer_BYTES_PER_BURST, DMA_Buffer_REQUEST_PER_BURST,
DMA_Buffer_TD = CyDmaTdAllocate();
CyDmaTdSetConfiguration(DMA_Buffer_TD, LENGTH*2, /*DMA_Buffer_TD*/ DMA_END_CHAIN_TD, DMA_Buffer__TD_TERMOUT_EN | TD_INC_SRC_ADR | TD_INC_DST_ADR);
CyDmaTdSetAddress(DMA_Buffer_TD, LO16((uint32)Filter_Ch_A), LO16((uint32)Buffered_Filter_Ch_A));
I have seen similar situations before, when I wasn't using the DFB filter, and a double buffer fixed it, because I was accessing the array when it was half way through being populated, which is why I added the second buffer that didn't need a HW request each time. This time though it does not seem to work, what am I doing wrong?
I do not think it is a problem with the DMA transfer between the ADC and the filter component, since there is no array being created there and it is a direct sample by sample transfer. Also I would imagine the filter would not result in such a direct peak, and rather would create a much more rounded dip.
Thanks in advance for all of your help,