STM32U5 ADC internal channel
Hello,
I'm facing some issues sampling ADC internal channel in of STM32u575.
In particular these are the steps I'm following:
VDDA enable
ADC Clock Configuration
HAL_ADC_Init (&ADC_Handle[i])
Interrupt configuration.
Then, I configure the ADC channel to read VREFINT and start a conversion, which is ok.
After that, when configuring ADC channel to read the internal temperature sensor, even if the function HAL_ADC_ConfigChannel returned ok, the temperature read value had no sense (-240°C which is just a little bit too cold).
I found out that by looking into config channel function that:
/* Parameters update conditioned to ADC state: */
/* Parameters that can be updated only when ADC is disabled: */
/* - Single or differential mode */
/* - Internal measurement channels: Vbat/VrefInt/TempSensor */
if (LL_ADC_IsEnabled(hadc->Instance) == 0UL)
This condition prevents me to configure internal channel id ADC is already enabled, however it does not return any error if the condition is met.
So, I was wondering if this is the right behaviour and if it is stated somewhere in the reference manual as I found out that bypassing these checks:
if (LL_ADC_IsEnabled(hadc->Instance) == 0UL)
if(__LL_ADC_IS_ENABLED_ALL_COMMON_INSTANCE(__LL_ADC_COMMON_INSTANCE(hadc->Instance)) == 0UL)
I get a correct temperature reading.
For now I'm disabling the ADC every time I need to change internal channel to ensure a correct reading.
Best regards,
Matteo
