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.
I know it is not a good thing to change the BSP without permission, but I have tentatively confirmed that the battery voltage can be measured from 4.2V to 2.5V using the following patch.
As I maintain they have NO interest in fixing it either. Their local Shill however will tell you they are the best thing since sliced bread… LOL
They were a graphics card co., and have really NO business in the MCU game at All!
Great for blinking LED’s Though!
Yes, one post on this is Sufficient. You don’t say much about how and what you use to do it or provide any Serial output. This may be more informative if you provide more info.
Hi, I just checked the schematic and did a few test measurements at different voltages to get this calibrated, so far it seems good and I’m currently discharging the battery to check further. It started at about 4200 and currently sitting at 3850 and still measuring as expected.
I’m shutting down the device at 3.5V since then the battery is almost drained so hopefully it works for me. I see the issue with using VDD ref now…
That doesn’t seem quite right. Given the battery life calculator on Digikey and others, for a single-cell LiPo battery, the “3.85V” rating is typically the nominal voltage. In practice, a LiPo battery usually measures around:
Fully charged: about 4.2V
Nominal voltage: roughly 3.7V to 3.85V
Discharged (cutoff): around 3.0V
So, during normal operation, you might see a voltage range from about 4.2V down to around 3.0V many nRF52840-based boards include a voltage regulator that can take the full battery range (4.2V to ~3.0V) and provide a steady operating voltage for the chip.
this just adds to the miss of the Mark iIMO…
HTH
GL PJ
Wow, Nice work @msfujino Pretty straight forward as well.
I just don’t understand why these vendors don’t fix this stuff they owe you a big GIFT basket for saving there face IMO.
GL PJ
I guess we can expect a New BSP from SIL 2.3.1 but I’m not Holding my Breath
This patch is only provisional and should only be used to measure the battery voltage of the XIAO_MG24.
It is my strong hope that a BSP will be released that will correctly measure the battery voltage of the XIAO_MG24 without causing problems for all boards.