cancel
Showing results for 
Search instead for 
Did you mean: 

Gain adjustment on audio line when using STM32F103

srikrishnan
Associate II
Posted on October 21, 2016 at 18:27

Hi,

I am having ADC3 bring in input from the microphone and I want to just the gain (amplitude) by 2 and then send it out through one of the DAC channels. So far, I have ADC and DAC synced through TIM8 and TIM6 respectively at 48kHz.

When I dont have any gain adjustment and route input to output, I am alright. But when I try to just the gain my multiplying a scalar with each value of the stored ADC, I get random output on the DAC.

I am implementing this multiplication in the ADC Conversion complete function as follows:

void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc3)

{

if(hadc3 -> Instance == ADC3)

  {

    mValues[0]=aADCxConvertedValues[0]>>1;

    mValues[1]=aADCxConvertedValues[1]>>1;

    HAL_DAC_Start_DMA(&hdac, DAC_CHANNEL_2, (uint32_t *)mValues, 2, DAC_ALIGN_12B_R);

    }

}

Is there a different technique I can try? Are there any app notes or any other ST resource anyone can point me to?

#adc #dac #stm32f103 #gain
1 REPLY 1
srikrishnan
Associate II
Posted on October 24, 2016 at 03:33

Bumping this to see if I can attract a response..