cancel
Showing results for 
Search instead for 
Did you mean: 

adc noise

pedropbr
Associate II
Posted on December 05, 2010 at 02:40

adc noise

8 REPLIES 8
pedropbr
Associate II
Posted on May 17, 2011 at 14:17

Hi,

I noticed that the configuration I did is working but the TxBuffer is getting filled very quick. The timer was used to control the speed that the TxBuffer was filled.

Thanks
pedropbr
Associate II
Posted on May 17, 2011 at 14:17

I changed the topic because the old one is not appliable anymore and nobody answered

Andrew Neil
Evangelist III
Posted on May 17, 2011 at 14:17

''Is it normal to listen to a background noise with my voice when using the internal ADC?''

The ADC is irrelevant - all electrical signals are subject to noise!

And, of course, acoustic signals are also subject to noise!

Minimising the noise requires very careful design of the recording environment, the microphone, and the analogue input circuitry.

A major source of noise for an internal ADC specifically can be all the other digital circuits in the chip.

There is a huge amount of material available in books, on the internet, etc, about low-noise design - including low-noise design specifically for ADC inputs...

''I noticed that, even though when there is nothing in the input, the ADC stores something around 2048 (4096/2). Is it normal?''

You haven't given any details at all of your input circuitry to the ADC (or even what particular STM32 part you're using) - so it's impossible to say whether it is to be expected for your particular setup!

But remember that an audio signal has both positive and negative excursions - so it would not be unusual to arrange for an ADC to give a ''half-scale'' output at zero...
pedropbr
Associate II
Posted on May 17, 2011 at 14:17

Hi Neil,

I'm using STM32F107VC in an IAR Development Kit.

Does anyone know how the buzzer works? I'd like to use it in its maximum volume.

Thanks
Posted on May 17, 2011 at 14:17

According to the schematic, it's connected to PD.13 (TIM4_CH2)

http://www.iar.com/website1/50.0.1.0/489/IAR-STM32F107VC-SK_REV-1.pdf

One might assume you drive it with the GPIO pin directly, or use TIM4 to PWM, or otherwise excite it.

Try looking at the data sheet for the PB1221P and the schematic.

http://www.mallory-sonalert.com/specifications/PB-1221P.pdf

http://www.mallory-sonalert.com/specifications/PB-1221PQ.pdf

Can't be that hard can it, to drive it with a 2.048 KHz square wave?
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
John F.
Senior
Posted on May 17, 2011 at 14:17

Looks like the sounder is a self oscillating device. Just power it by driving the transistor ON. Since the sounder is rated for a 2.5V supply and is connected to a 3.3V supply it's already being overdriven.

Posted on May 17, 2011 at 14:17

Looks like the sounder is a self oscillating device. Just power it by driving the transistor ON.

 

No the specs suggest it needs a ~2 KHz square-wave

IAR/Olimex example code looks to be banging it at about 2.5 KHz

Slightly edited for clarity, but still overly verbose...

  TIM_TimeBaseInitTypeDef  TIM_TimeBaseStructure;

  GPIO_InitTypeDef GPIO_InitStructure;

  TIM_OCInitTypeDef TIM_OCInitStructure;

  // Buzzer init

  // GPIO enable clock and release Reset

  RCC_APB2PeriphResetCmd(  RCC_APB2Periph_GPIOD

                         | RCC_APB2Periph_AFIO, DISABLE);

  RCC_APB2PeriphClockCmd(  RCC_APB2Periph_GPIOD

                         | RCC_APB2Periph_AFIO, ENABLE);

  GPIO_InitStructure.GPIO_Pin =  GPIO_Pin_13;

  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;

  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;

  GPIO_Init(GPIOD, &GPIO_InitStructure);

  // Init PWM TIM4

  // Enable Timer4 clock and release reset

  RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM4,ENABLE);

  RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM4,DISABLE);

  TIM_InternalClockConfig(TIM4);

  GPIO_PinRemapConfig(GPIO_Remap_TIM4,ENABLE);

  // Time base configuration

  TIM_TimeBaseStructure.TIM_Prescaler = 110;

  TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;

  TIM_TimeBaseStructure.TIM_Period = 0x100 - 1; // 8 bit resolution

  TIM_TimeBaseStructure.TIM_ClockDivision = 0;

  TIM_TimeBaseStructure.TIM_RepetitionCounter = 0;

  TIM_TimeBaseInit(TIM4,&TIM_TimeBaseStructure);

  // Channel 2 Configuration in PWM mode

  TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM1;

  TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable;

  TIM_OCInitStructure.TIM_OutputNState = TIM_OutputNState_Enable;

  TIM_OCInitStructure.TIM_Pulse = 0x80;

  TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_High;

  TIM_OCInitStructure.TIM_OCNPolarity = TIM_OCNPolarity_High;

  TIM_OCInitStructure.TIM_OCIdleState = TIM_OCIdleState_Set;

  TIM_OCInitStructure.TIM_OCNIdleState = TIM_OCIdleState_Reset;

  TIM_OC2Init(TIM4,&TIM_OCInitStructure);

  // Double buffered

  TIM_ARRPreloadConfig(TIM4,ENABLE);

  // TIM4 counter enable

  TIM_Cmd(TIM4,ENABLE);

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
pedropbr
Associate II
Posted on May 17, 2011 at 14:17

Thanks!

I concluded that isn't possible to increase the buzzer volume. It's made to achieve its maximum when oscillating at 2048Hz.

In the directory below, there is very clear example about how to change the frequency of the Timer PWM Mode, used with Buzzer.

\arm\examples\ST\STM32F10x\stm32f10x_stdperiph_lib\Project\STM32F10x_StdPeriph_Examples\TIM\PWM_Output

Now I'm looking for a buzzer which has a good frequency response at the higher audible frequency possible. If you have any suggestions...