I'm using the ADC of nRF52832 on nRF5 SDK V12.2. The setting as attachment. I found that it just do sample one time. But I have use timer to call nrf_drv_saadc_sample() to the SAADC sample task every second. However, I just can see one adc result and the result is correct. Could you help me have a look? Thanks.
Your code does not show how you trigger sampling. It is very hard to say why it only trigger one sample without seeing the rest of your code. Do you know if your code continues to run or if it halts at an error? What is the size of SAADC_SAMPLES_IN_BUFFER?
I use APP_TIMER_DEF(m_battery_voltage_id);to creat a timer and then I use nrf_drv_saadc_sample() to trigger the ADC to sample when the timer timeout. The SAADC_SAMPLES_IN_BUFFER is 1, I also try other number such as 5, but the result is the same. I know the code is runing well ,because the timer is running all the time and I will prinf a debug information when timer timeout.
Could you upload the code for review/debugging?
The whole project is too large, so I upload the main.c document, pls see the attachment. Thanks.
I can't see anything in particular that should stop the sampling after one sample, but you should try checking all error codes, to make sure no functions return errors:
In battery_voltage_timeout_handler(), check the error code from nrf_drv_saadc_sample():
uint32_t err_code = nrf_drv_saadc_sample(); //Trigger the SAADC SAMPLE task
You should also check error codes on calls to app_timer_create and app_timer_start.