STM32F401RE ADC conversion when Vin > Vref+
On a NUCLEO-F401RE, I am observing strange conversion values when I apply higher voltage than Vref to an ADC pin and carry out conversion on it. I would have expected the converted value to be 4095 (0fff) but in reality it is more like 3233 (0ca1) for a 5V input, so there is no way of distinguishing a genuine 2.6V input from a 5V input, for example. I get the expected values in the range 0V -> 3.3V.
The datasheet for the STM32F401re says that the GPIO pin in question (PC0) is FT and that FT pins are 5V tolerant. The manual also shows that the input is internally clamped between 0 and VDD_FT (Figure 16. Basic structure of a five-volt tolerant I/O port bit).
Is there a way to detect when Vin > Vref? And what could explain this apparently valid conversion?
Thanks.
/
I am polling the port using the following code:
HAL_ADC_Start(&hadc1);
if (HAL_ADC_PollForConversion(&hadc1, 1) == HAL_OK)
{
ADCValue = HAL_ADC_GetValue(&hadc1);
}
HAL_ADC_Stop(&hadc1);I have tried in both continuous and single conversion mode. Same behaviour.
