I am using nrf52832, SDK14 and sd 132.5.0. I want to disable SAADC after measuring battery level then enable again when I want to measure it again like in this post. When I try to do that it resets device every time in this handler.
static void battery_level_meas_timeout_handler(void * p_context){
UNUSED_PARAMETER(p_context);
static int i=0;
if(i!=0) //don't initialize twice at the beginning
{
nrf_drv_saadc_init(NULL, saadc_event_handler);
}
i=1;
ret_code_t err_code;
err_code = nrf_drv_saadc_sample();
APP_ERROR_CHECK(err_code);
nrf_drv_saadc_uninit();
NVIC_ClearPendingIRQ(SAADC_IRQn);
}
How can I solve this problem? Also I am using DFU in my application(May it cause?). This way is working in blinky example, but in my application it resets.