tinygo-org/tinygo

nrf52xxx: ADC configuration do not support VDD as reference

Opened this issue · 0 comments

The ADC config of nrf devices use always the internal reference voltage 0.6V, see

nrf.SAADC_CH_CONFIG_REFSEL_Internal<<nrf.SAADC_CH_CONFIG_REFSEL_Pos |

Because this defaults to 3.0V (gain=1/5) the cause for the unexpected small difference is not easy to narrow down if one is using a resistor network for some reason, e.g. a battery driven device with a variable resistor and connect this to the common VDD=3.3V. So this should be mentioned e.g. in the existing example or on the documentation page of the nrf52x-based device(s).

Additionally it would be good, to implement the VDD/4 as reference and maybe use this as the default.

The new PS can be found here: https://docs.nordicsemi.com/bundle/nRF52832_PS_v1.9/resource/nRF52832_PS_v1.9.pdf

Nevertheless, many thanks for this great piece of software!