AnsweredAssumed Answered

Why my ADC value alternates when signal is steady?

Question asked by Sandaker_Palm.He.001 on Dec 29, 2016
Latest reply on Jan 16, 2017 by Sandaker_Palm.He.001

Hi,

I'm quite new to STM32 and Cube HAL. Hardware is custom, mcu is STM32F042G6Ux, created initial code with Cube MX. IDE is SW4STM32.

 

The issue is that the ADC value is alternating somewhat between two values (roughly 300-something mostly and sometimes 1700-something). I see it while debugging, I do one iteration of the main while-loop and watch the ADC value adc_val returned from HAL_ADC_GetValue function. The voltage is around 450mV. The reading of the internal temperature via ADC is stable and fine.

 

Here is the code (how to embed code properly?): http://pastebin.com/rvLLcXsk 

Outcomes