I am developing a NIR (Near-Infrared) product using nRF52810.
I use 15.3 for SDK and S112 for Softdevice.
I implemented ADC (saadc) function based on ble_app_uart.
I have to read 2 ADC channels at 62.5KHz (16usec) for NIR measurement.
I made a test code and tried it out.
However, if nrf_drv_saadc_sample () is called 100 times in 62.5KHz (16usec), saadc_callback (nrf_drv_saadc_evt_t const * p_event) is rarely performed.
If nrf_drv_saadc_sample () is called 100 times in approximately 1KHz (1,000 usec) units, saadc_callback (nrf_drv_saadc_evt_t const * p_event) is performed 100 times.
As a result of my measurement test, the maximum sampling rate for ADC 2 channels is 1KHz (1,000usec).
That is, the maximum sampling rate is too slow for NIR measurement.
Looking at the nRF52810 datasheet, the SAADC Maximum sampling rate is 200KHz.
How can I read ADC 2channel in 62.5KHz (16usec) unit?
My test code is here.
In the code above, I set TIMER to 1,000usec.
When timer_handler is called 100 times (count_num = 100), saadc_callback (cnt_cnt = 100). It is OK.
So, as a result of my testing, the maximum sampling rate is 1KHz.
Set TIMER to 1000usec or less,
If timer_handler is called 100 times (count_num = 100), saadc_callback is executed 80-90 times.
(cnt_cnt <100).
Additional comments:
Ultimately, I want to use a method to call nrf_drv_saadc_sample () through an external interrupt input pin in 62.5KHz.
So the timer routine in the current code is also using the method to call nrf_drv_saadc_sample ().
Thank you.