2024-06-12 12:34 AM
I am using a Nucleo-u083rc to run the ADC_MultiChannelSingleConversion Application from STM32Cube MCU Package for STM32U0 series `
However, when using the helper function the value returned is completely wrong:
uhADCxConvertedData[1] = 1503. Which is what I'd expect, however, the value returned by the helper function is 65185.
uhADCxConvertedData_VrefAnalog_mVolt = __LL_ADC_CALC_VREFANALOG_VOLTAGE(uhADCxConvertedData[1], LL_ADC_RESOLUTION_12B);
This means the following code returns the wrong values
/* Computation of ADC conversions raw data to physical values */
/* using LL ADC driver helper macro. */
uhADCxConvertedData_VoltageGPIO_mVolt = __LL_ADC_CALC_DATA_TO_VOLTAGE(uhADCxConvertedData_VrefAnalog_mVolt, uhADCxConvertedData[0], LL_ADC_RESOLUTION_12B);
uhADCxConvertedData_VrefInt_mVolt = __LL_ADC_CALC_DATA_TO_VOLTAGE(uhADCxConvertedData_VrefAnalog_mVolt, uhADCxConvertedData[1], LL_ADC_RESOLUTION_12B);
hADCxConvertedData_Temperature_DegreeCelsius = __LL_ADC_CALC_TEMPERATURE(uhADCxConvertedData_VrefAnalog_mVolt, uhADCxConvertedData[2], LL_ADC_RESOLUTION_12B);
If I replace the previous code with the following:
/* Computation of ADC conversions raw data to physical values */
/* using LL ADC driver helper macro. */
uhADCxConvertedData_VoltageGPIO_mVolt = __LL_ADC_CALC_DATA_TO_VOLTAGE(VDDA_APPLI, uhADCxConvertedData[0], LL_ADC_RESOLUTION_12B);
uhADCxConvertedData_VrefInt_mVolt = __LL_ADC_CALC_DATA_TO_VOLTAGE(VDDA_APPLI, uhADCxConvertedData[1], LL_ADC_RESOLUTION_12B);
hADCxConvertedData_Temperature_DegreeCelsius = __LL_ADC_CALC_TEMPERATURE(VDDA_APPLI, uhADCxConvertedData[2], LL_ADC_RESOLUTION_12B);
The correct values are calculated for:
huADCxConvertedData_VoltageGPIO_mVolt and
hADCxConvertedData_Temperature_DegreeCelsius
What am I missing about the helper macro?
Regards
Sean