Hi
I am running saadc battery measurement using the refernce code.
When I run the adc_configure() I have about 500uA consumption
then According to this thread I run this code (below 3 lines) after I read the battery level in the saadc_event_handler()
nrf_drv_saadc_uninit();
NRF_SAADC->INTENCLR = (SAADC_INTENCLR_END_Clear << SAADC_INTENCLR_END_Pos);
NVIC_ClearPendingIRQ(SAADC_IRQn);
The problem occuers when I try to re-start the measument again, the device crash if I run adc_configure() or even just run nrf_drv_saadc_init()
Any advice? why does this occuer?
void adc_configure(void)
{
ret_code_t err_code = nrf_drv_saadc_init(NULL, saadc_event_handler);
APP_ERROR_CHECK(err_code);
nrf_saadc_channel_config_t config =
NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_SE(NRF_SAADC_INPUT_VDD);
err_code = nrf_drv_saadc_channel_init(0, &config);
APP_ERROR_CHECK(err_code);
err_code = nrf_drv_saadc_buffer_convert(&adc_buf[0], 1);
APP_ERROR_CHECK(err_code);
err_code = nrf_drv_saadc_buffer_convert(&adc_buf[1], 1);
APP_ERROR_CHECK(err_code);
//reduce 500uA from saadc currents
// nrf_drv_saadc_uninit();
// NRF_SAADC->INTENCLR = (SAADC_INTENCLR_END_Clear << SAADC_INTENCLR_END_Pos);
//NVIC_ClearPendingIRQ(SAADC_IRQn);
}