I am using an N52811 QFN32 on a custom board.
I modified the SAADC sample as follows and ran it on this board.
(3.0V was input to AIN2.)
void saadc_init(void) { ret_code_t err_code; nrf_drv_saadc_config_t saadc_config = NRF_DRV_SAADC_DEFAULT_CONFIG; saadc_config.resolution = NRF_SAADC_RESOLUTION_12BIT; nrf_saadc_channel_config_t channel_config = NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_SE(NRF_SAADC_INPUT_AIN2); channel_config.gain = NRF_SAADC_GAIN1_6; err_code = nrf_drv_saadc_init(&saadc_config, saadc_callback); APP_ERROR_CHECK(err_code); err_code = nrf_drv_saadc_channel_init(0, &channel_config); APP_ERROR_CHECK(err_code); err_code = nrf_drv_saadc_buffer_convert(m_buffer_pool[0], SAMPLES_IN_BUFFER); APP_ERROR_CHECK(err_code); err_code = nrf_drv_saadc_buffer_convert(m_buffer_pool[1], SAMPLES_IN_BUFFER); APP_ERROR_CHECK(err_code); }
However, p_event->data.done.p_buffer[] returns a value around 1750, which is about half of what the specification would suggest.
When I run the same program on an nRF5 DK (PCA10056), it gives a value of about 3380, which I believe is correct.
When I directly measure the voltage between PIN 29 (VSS) and PIN 4 (P0.04/AIN2) on the custom board’s chip, it correctly shows 3.0V.
Is there any other configuration that might affect the SAADC?