Poor ADC quality on some Nucelo boards
Hi everyone :)
I need your help. I am currently writing my masther thesis and I need robust and not noisy ADC read. I am using Nucleo board in my project so I hope hardware should have no effect in my case. The problem is ADC quality. I've tested three different boards: F411RE(100MHz) F207ZG(120MHz) H745ZI-Q(400MHz). All boards were running with their internal RC clocks.
ADC for each one was configured in similar way i.e.:
- ADC clock around 7.5MHz,
- 12bit resolution,
- measurement frequency 10kHz (triggered from timer ISR),
- sample time around 15 cycles,
- polling method.
For test purpose I chose 1.5V battery to be measured and I realised that unfortunately only F411 returns stable voltage. I mean the noise was Vpp=10mV. Whereas the other mentioned boards delivered really unstable values (noise Vpp=250mV). I don't understand what is going on :frowning_face:


Here is the code I've used for ADC measurement:
/* USER CODE BEGIN 0 */
#define ADC_RESOLUTION 4096
#define ADC_REF_MV 3300
#define SIGNAL_SIZE 1000U
volatile static uint32_t raw_signal[SIGNAL_SIZE];
volatile static int32_t signal[SIGNAL_SIZE];
static uint16_t idx = 0U;
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
{
if (htim == &htim4)
{
HAL_ADC_Start(&hadc1);
HAL_ADC_PollForConversion(&hadc1, HAL_MAX_DELAY);
raw_signal[idx] = HAL_ADC_GetValue(&hadc1);
signal[idx] = (int32_t)raw_signal[idx] * ADC_REF_MV / ADC_RESOLUTION;
if (++idx >= SIGNAL_SIZE)
{
idx = 0U;
}
}
}
/* USER CODE END 0 */If you happen to know any reason for my problem, please let me know in comments :frowning_face:

