2023-04-23 02:52 PM
2023-04-23 10:37 PM
There are currently 286 different variants of the family of STM32G0 devices. However, I assume that you mean the STM32G030KT6, since you have already asked several questions about it?
However, your problem cannot be understood yet, because you talk about two functions on one pin, but only mention IN16 (presumably you mean ADC1_IN16 here). Can you please explain your problem in more detail?
Regards
/Peter
2023-04-24 05:19 AM
Just as a reference to your other question, which is similar.
2023-04-25 03:19 AM
Hi
The PN is STM32G030KT6. My question is basically how can I use the internal calibration to increase the accuracy of the ADC reading? Therefore I was trying to read the actual value of VDD. What would be the best option?
BR
Gilberto
2023-04-25 04:07 AM
Well, you should at least work through the RM0360 (edit: RM is from STMF030, see next answer), where among other things the calibration of the ADC is described in section 12.4.1.
There is also a bare metal example in section A.7.1. (edit: only applies to STM32F030).
If you use the HAL, you only need to call the function HAL_ADCEx_Calibration_Start() once with the handle of the ADC.
With the STM32G030, however, you have to keep in mind that VREF+ is internal permanently connected to VDDA. This means that you can only measure ratiometrically, i.e. relative to the supply voltage. For an absolute value measurement of a voltage at a GPIO, which may not exceed VDDA, you must therefore always perform a second measurement of the internal reference voltage via ADC_IN17, alternatively of an external reference voltage. Then you can calculate the absolute value of the first voltage.
Hope that helps?
Regards
/Peter
2023-04-25 05:14 PM
Hi
Yes it helped a lot!
Is it necessary to call HAL_ADCEx_Calibration_Start() after exiting stop mode?
BR
Gilberto
2023-04-25 11:57 PM
Oops, sorry, I mistakenly gave you the reference manual of the STM32F030 instead of the G030 as the source of information, but the principle is identical for both series. In the correct RM0454 you will find the mentioned section Calibration (ADCAL) under 14.3.3.
After the Stop Mode, it should not be necessary to run the calibration again, but it is necessary after a Standby (see RM0454 mentioned above).
Regards
/Peter