cancel
Showing results for 
Search instead for 
Did you mean: 

ADC on NUCLEO-F446RE very noisy, some suggestions are needed.

GStra.1
Associate II

Hi all!

I'm developing on a evaluation board NUCLEO-F446RE STM32 F4.

I've to read an adc input in order to monitor a battery.

There's a lot of unexpected noise in my acquired data, as visibile in attahments.

I've tied directly the adc input to Vref and to a function generator, this noise in always well

present, as visibile in the attachment below.

I've been tryng to tie vref to a very clean reference, but nothing changed.

Can somenone tell me how to indepth my investigation?

Below my adc settings:

__ADC1_CLK_ENABLE ();

 gpioInit . Pin  =  GPIO_PIN_0 ;

 gpioInit . Mode  = GPIO_MODE_ANALOG ;

 gpioInit . Pull  = GPIO_NOPULL ;

 HAL_GPIO_Init ( GPIOA ,  & gpioInit );

 HAL_NVIC_SetPriority ( ADC_IRQn ,  5 ,  0 );

 HAL_NVIC_EnableIRQ ( ADC_IRQn );

 hadc1.Instance = ADC1;

 //hadc1.Init.ClockPrescaler = ADC_CLOCK_SYNC_PCLK_DIV4;

 hadc1.Init.ClockPrescaler = ADC_CLOCK_SYNC_PCLK_DIV8;

 hadc1.Init.Resolution = ADC_RESOLUTION_12B;

 //hadc1.Init.ScanConvMode = DISABLE;

 hadc1.Init.ScanConvMode = ENABLE;

 //hadc1.Init.ContinuousConvMode = DISABLE;

 hadc1.Init.ContinuousConvMode = ENABLE;

 hadc1.Init.DiscontinuousConvMode = DISABLE;

 hadc1.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE;

 hadc1.Init.ExternalTrigConv = ADC_SOFTWARE_START;

 hadc1.Init.DataAlign = ADC_DATAALIGN_RIGHT;

 //hadc1.Init.NbrOfConversion = 1;

 hadc1.Init.NbrOfConversion = 3;

 //hadc1.Init.DMAContinuousRequests = DISABLE;

 hadc1.Init.DMAContinuousRequests = ENABLE;

 //hadc1.Init.EOCSelection = ADC_EOC_SINGLE_CONV;

 hadc1.Init.EOCSelection = EOC_SEQ_CONV;

 //hadc1->Init.SamplingTimeCommon = ADC_SAMPLETIME_112CYCLES;

 if (HAL_ADC_Init(&hadc1) != HAL_OK)

 {

   Error_Handler();

 }

 /** Configure for the selected ADC regular channel its corresponding rank in the sequencer and its sample time.

 */

 sConfig.Channel = ADC_CHANNEL_0;

 sConfig.Rank = 1;

 //sConfig.SamplingTime = ADC_SAMPLETIME_3CYCLES;

 sConfig.SamplingTime = ADC_SAMPLETIME_480CYCLES;

 if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK)

 {

   Error_Handler();

 }

 sConfig.Channel = ADC_CHANNEL_TEMPSENSOR;

 sConfig.Rank = 2;

 //sConfig.SamplingTime = ADC_SAMPLETIME_3CYCLES;

 sConfig.SamplingTime = ADC_SAMPLETIME_112CYCLES;

 if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK)

  {

     Error_Handler();

  }

 sConfig.Channel = ADC_CHANNEL_VREFINT;

 sConfig.Rank = 3;

 //sConfig.SamplingTime = ADC_SAMPLETIME_3CYCLES;

 sConfig.SamplingTime = ADC_SAMPLETIME_112CYCLES;

 if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK)

 {

       Error_Handler();

 }

0693W00000CzsUAQAZ.png 

0693W00000CzsTgQAJ.png

1 ACCEPTED SOLUTION

Accepted Solutions

ADC in what's primarily a massive digital circuit is always inherently noisy and 10 bins of noise is nothing extraordinarily excessive. To get below that requires quite an amount of work - very careful analog supply and ground(!) routing/decoupling/separation from digital supply/ground, careful choice of ADC clock, sampling time, careful conditioning of the input signal, stopping the digital part while taking ADC readings, digital post-processing/filtering, etc. - and the result still may seem underwhelming. That's just reality.

Read AN4073.

JW

View solution in original post

1 REPLY 1

ADC in what's primarily a massive digital circuit is always inherently noisy and 10 bins of noise is nothing extraordinarily excessive. To get below that requires quite an amount of work - very careful analog supply and ground(!) routing/decoupling/separation from digital supply/ground, careful choice of ADC clock, sampling time, careful conditioning of the input signal, stopping the digital part while taking ADC readings, digital post-processing/filtering, etc. - and the result still may seem underwhelming. That's just reality.

Read AN4073.

JW