This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nrf52 multiple signal sampling with softdevice

I migrated to nrf52 and countering some problems. I am trying to sample 4 pins every 2ms with SAADC.

I started with Example here.

I simply changed

uint32_t ticks = SAADC_SAMPLE_RATE_DIVIDER;
nrf_drv_timer_extended_compare(&m_timer, NRF_TIMER_CC_CHANNEL0, ticks, NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK, false);
nrf_drv_timer_enable(&m_timer);

This part to

uint32_t ticks = nrf_drv_timer_ms_to_ticks(&m_timer, 2);

in order to sample every 2 ms.

Initial sampling rate works but when I change the sampling rate to 2ms, I do not get constant data transfer and connection with BLE. Also, the phone sometimes loses connection with the chip with GATT CONN TIMEOUT (err 133).

From my understanding, since ADC is triggered by PPI soft device should have a minimal effect even with fast intervals. Can somebody help me debug this problem?

Also with a soft device enabled, is using PPI the best method for triggering ADC sampling? I know that there are multiple ways to trigger SAADC sampling. Like in ble_app_proximity example, they just use nrf_drv_saadc_sample(); function and adc_event_handler

Can somebody explain the difference between using a PPI and the method used in ble_app_proximity example?