cancel
Showing results for 
Search instead for 
Did you mean: 

Hi Can somone me give some info on how to uase the adc calVrefint and ibration factor on a STM32G0 device? Also, I would like to know how to read both the IN16 using HAL. They are connected at the same IO PIN.

GErma.1
Associate III
6 REPLIES 6
Peter BENSCH
ST Employee

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

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
Peter BENSCH
ST Employee

Just as a reference to your other question, which is similar.

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
GErma.1
Associate III

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

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

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
GErma.1
Associate III

Hi

Yes it helped a lot!

Is it necessary to call HAL_ADCEx_Calibration_Start() after exiting stop mode?

BR

Gilberto

Peter BENSCH
ST Employee

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

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.