XIAO_MG24 battery voltage measurement function is not available

The XIAO_MG24 has the ability to measure battery voltage by dividing it by 1/2.
Assuming the maximum battery voltage is 4.2V, the full scale of AD conversion requires at least 2.1V. The reference voltage Vref can be selected from the internal reference voltage of 1.2V or VDD (3.3V). When Vref=1.2V is selected, battery voltages above 2.4V cannot be measured. When Vref=VDD(3.3V) is selected, battery voltage below 3.3V cannot be measured because VDD drops below 3.3V.
On the other hand, the MG24 chip has a function that allows the AD converter input gain to be set, and if GAIN = 0.5, the battery voltage can be AD converted with a margin with Vref = 1.2V.
Unfortunately, BoardSupportPackage 2.2.0 does not have a function to set gain.

Is there any good solution?

1 Like

Hi there,

So I wasn’t able to get it to work, and have reached out to @Chunchun for advisement.
HTH
GL :slight_smile: PJ :v:

1 Like