HAL_ADC_GetValue giving wrong values
I'm trying to use HAL_ADC_GetValue to get the ADC value from an STM32L082 attached to a battery giving 3.7V. My goal is to use the ADC value to estimate the battery percentage so I need the ADC value when the battery is full and when it's mostly empty. The problem i'm facing is that the HAL_ADC_GetValue always returns 4095 when the battery is above a certain voltage and it wont go below 3600 even though the voltage is lowered (so at 3.25 volt it returns 3600 and also at 2.9 volt). Between these two points it works perfectly.
Does anybody know what could be causing the problem?
