Help needed with Multi-channel DMA on love audio to DAC using DMA
Hello,
I am trying to use the STM32G491RE nucleo to create a DSP for live audio in the voice band range. Right now I'm just focused on trying to get data in at the ADC using timer 7 to pull data from the ADC at an 8Khz sample rate as I don't want to sample for audio above 4Khz. I'm using a double buffer technique to pull data in transferring using the DMA and just simply pass it along to the DAC. I wanted to ensure I'm not losing signal integrity before trying to perform any signal processing. Since I'm using multiple channels on the ADC, the HAL_ADC_ConvCpltCallback() function will only pull one sample at a time for each channel. Currently I am only pulling data from one channel but eventually will scale it to 8 or more once I get it working on one channel. Once scan conversion is complete I store these samples in a buffer, no signal processing at this point, and once I have half the array filled with samples I send it to DAC for output. I tried both double buffering and no buffering method i.e. just fill up the array with 64 samples and send it to DAC, and I get the same result. The result is audio sent be to the sampled by the ADC channel 1 on PA0 and output to the DAC sounds very muffled, static filled, and choppy. So I am getting some data out that comes into the ADC but it appears maybe not all and it's highly distorting the original signal by the time it gets to DAC output. I've tried researching what I may be doing wrong to lose signal integrity, but there are not a lot of resources I can find for my specific case of using multi-channel ADC, with Timer and DMA on live audio. I will attach IOC file and main.c file, if more information is needed to assess the problem, please let me know. There is syntax for a low-pass filter but is commented out for now until I can figure out how to not lose signal integrity. Any assistance would be greatly appreciated. Thanks STM community.
Additional note, here is where most of the work I'm talking about is happening:
