Hi,
When I try to stop ADC sampling, the adc driver keeps on busy. The function nrf_drv_saadc_is_busy() keeps returning true.
I looked in other posts (like this one) and found that this is the way to start and stop ADC:
void start_adc() { saadc_sampling_event_init(); saadc_init(); saadc_sampling_event_enable(); } void stop_adc() { nrf_drv_timer_disable(&m_timer); nrf_drv_ppi_channel_disable(m_ppi_channel); while(nrf_drv_saadc_is_busy()); //--> always true nrf_drv_saadc_uninit(); }
But this is not working because while(nrf_drv_saadc_is_busy()); keeps returning true.
I'm using SDK 14 with double buffer and ble communication.
I read also this post and understood that it might be because of the double buffer. So I tried disabling it by:
1. Changing static nrf_saadc_value_t m_buffer_pool[2][SAADC_SAMPLES_IN_BUFFER] to static nrf_saadc_value_t m_buffer_pool[1][SAADC_SAMPLES_IN_BUFFER]
2. Deleting the following from saadc_init():
err_code = nrf_drv_saadc_buffer_convert(m_buffer_pool[1],SAADC_SAMPLES_IN_BUFFER); APP_ERROR_CHECK(err_code);
and left only with:
err_code = nrf_drv_saadc_buffer_convert(m_buffer_pool[0],SAADC_SAMPLES_IN_BUFFER); APP_ERROR_CHECK(err_code);
Am I doing this correctly?
Thanks!