Unable to get a valid ADC-value
Hello everyone,
at first the Discoveryboard I'm using is the P-L496G-Cell02 / STM32L496G-DISC.
To test the ADC I tried to recieve a value from a potentiometer.
So I started a new STM32CuvbeIDE project, Selected the board I'm using and changed the Pins (via the CubeMX Interface) to the correct Input. I tried it several times with different pins:
PC4 -> ADC2_IN13
PC1-> ADC1_IN2
PC3-> ADC1_IN4
And i changed the associated channel to Single-ended.
In the main fuction, i declared a variable raw and added the code in the while-loop
int main(void)
{
uint16_t raw;
HAL_Init();
SystemClock_Config();
MX_ADC2_Init();
while (1)
{
/* USER CODE END WHILE */
HAL_ADC_Start(&hadc2);
HAL_ADC_PollForConversion(&hadc2, HAL_MAX_DELAY);
raw = HAL_ADC_GetValue(&hadc2);
HAL_Delay(2);
/* USER CODE BEGIN 3 */
}
/* USER CODE END 3 */
}As a result raw is always 4095 (3.3V) even if i unplug the cable to the potentiometer.
I hope somebody can help me with this problem
