STM32F4 DSP noise with inbuilt ADC and DAC
I'm trying to perform signal filtering with STM32F407VGT. I've set up the ADC and DAC to work synchronously, triggered by a timer at 42kHz, and using DMA. The idea is to process half of the buffer while ADC is filling the other half. However, even without any processing, I'm getting a periodic noise in my signal(picture attached). Seems like some portion of the buffer is always messed up. Why is this happening and how can I fix it? I'm also attaching the relevant sections of my code here. Both ADC and DAC operate in 12bit mode and are triggered by Timer2. Both use DMA in circular mode.

#define DATASIZE 64
#define FULLBUFFSIZE 128
uint32_t adc_val[FULLBUFFSIZE];
uint32_t dac_val[FULLBUFFSIZE];
static volatile uint32_t* inbuffPtr;
static volatile uint32_t* outbuffPtr;
void process_DSP()
{
for (int n=0; n<DATASIZE; n++)
{
outbuffPtr[n] = inbuffPtr[n];
}
}
void HAL_ADC_ConvHalfCpltCallback(ADC_HandleTypeDef* hadc)
{
inbuffPtr = &adc_val[0];
outbuffPtr = &dac_val[DATASIZE];
process_DSP();
}
void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc)
{
inbuffPtr = &adc_val[DATASIZE];
outbuffPtr = &dac_val[0];
process_DSP();
}