cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F0 ADC DMA sample rate

justin
Associate II
Posted on July 25, 2013 at 08:40

I need to setup the ADC -> DMA to transfer at exactly 44100 hz. (Audio quality)

I have setup the DMA -> DAC by setting the clock to TIM_Period to 1088 (48Mhz / 1088 = 44117) 

But i dont seem to have this control over the ADC clock.

Im attempting a signal processor ADC >> DMA (Process the signal) >> DMA >> DAC

But i am having trouble syncronising.

Any help would be appreciated.

Cheers. 

#stm32f0-adc-dma-sample-rate
3 REPLIES 3
justin
Associate II
Posted on August 02, 2013 at 23:58

The original post was too long to process during our migration. Please click on the provided URL to read the original post. https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I6cf&d=%2Fa%2F0X0000000brw%2FzRrSJWKNxARA0OhuDQHuKDgEWY6rjoPq7fiHuVcqdXU&asPdf=false
Posted on August 03, 2013 at 02:07

It's a bit of a mess, and mix of thoughts.

You want to trigger the ADC with the TIM, the ADC does not need to be in continuous mode. You are trying to tie the two to a common rate.

You do not want the ADC/EOC interrupt.

The TIM14 is 16-bit, you're not using it as a trigger.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
justin
Associate II
Posted on August 03, 2013 at 23:15

Sorry Clive, this code has reminnets of my experimenting trying to get this working. I initially combined to examples, the ADC DMA and the DAC Signal generation example with the hope of getting a ADC -> DAC loop back. The first thing i tried was

while (1)
{
while((DMA_GetFlagStatus(DMA1_FLAG_TC1)) == RESET );
for(i = 0; i < ARRAYSIZE(Sine12bit); i++)
{
Sine12bit[i] = RegularConvData_Tab[i];
}
DMA_ClearFlag(DMA1_FLAG_TC1); // DMA_ClearFlag(DMA1_FLAG_TC3);
}

But pretty much the same results as the interrupt. I figured i had enough time CPU cycles between a single DMA transfer to process the buffer provided i had the sample rates synchronized. But as it would appear the is the wrong approach. I certainly feel your right about the continuous mode. I had a feeling this was tripping me up. As with the sample rate on the ADC. It would appear to me that i cannot just use any timer to trigger the ADC but i must be misreading the manual. I will give it a go and get back. Cheers