SAADC can't measure input voltage higher than VDD voltage.External battery (18650) voltage is higher than on-board VDD.There is very good article on your site explaining how to make this measurement possible.But it requires external resistors and (optionally) capacitor.As I can see, battery voltage is available in nRF52840 on the pin VDDH.And there is new feature implemented in nRF52840's SAADC - internal analog input VDDHDIV5.See: nRF5_SDK_15.2.0_9412b96, file nrf5-sdk/modules/nrfx/mdk/nrf52840_bitfields.h:11938.This means that theoretically we can avoid using external resistors (?)But there is an Errata notice #160 - VDDHDIV5 is not functional.So, I have 3 questions on this topicQ1:Is VDDHDIV5 usable or not?Q2:Can I use SAADC gain 1/2 on input VDDHDIV5, since voltage 4.2V / 5 = 0.84V is higher than internal reference 0.6V?Q3:...see subj.Thanks in advance
1) From PAN SAADC: VDDHDIV5 not functional: This anomaly applies to IC Rev. Engineering A, build codes QIAA-AA0.
I doubt you're using IC rev ENG A samples for your development. 2) With VDDHDIV5 and gain of 1/2 you're at 1/10 VDDH or 4.2V/10 = 420mV, which is less than 600mV.Though if you had exceeded 600mV you would just get the maximum output value, f.ex. 1023 for 10-bit resolution, you will just get clipped. That being said you can't exceed the maximum voltage of VDDH itself. 3)You can use VDDHDIV5 to measure the battery voltage. Do note that you should always sample VDDH at peak current otherwise you will sample at a higher battery voltage than what is supplied during peak current drawn.
I checked this internal input VDDHDIV5 of SAADC -- it works.
Luckily, battery voltage is connected directly to VDDH contact on a Dongle.And we can measure this voltage without external components.Dev board hasn't this option available.