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

Connection timeout after multi-channels ADC sampling start by timer

Dears,

I am using DK PCA10028 (V1.2.2). Start developing from  SDK_12.3.0\examples\ble_peripheral\experimental_ble_app_blinky.

All system configuration keep the same (ADC interrupt priority is 3).  

After add ADC sampling by soft-timer event  to sample  8 channels ADC0~ADC7 every 1000 ms. 

Whenever BLE connected, system soon turn to dis-connected. The return dis-connected reason is 0x08  (BLE_HCI_CONNECTION_TIMEOUT)

static void adc_config(void)
{
    ret_code_t ret_code;
    nrf_drv_adc_config_t config = NRF_DRV_ADC_DEFAULT_CONFIG;

    ret_code = nrf_drv_adc_init(&config, adc_event_handler);
    APP_ERROR_CHECK(ret_code);

	nrf_drv_adc_channel_enable(&m_channel_config0);
	nrf_drv_adc_channel_enable(&m_channel_config1);
    nrf_drv_adc_channel_enable(&m_channel_config2);
	nrf_drv_adc_channel_enable(&m_channel_config3);
	nrf_drv_adc_channel_enable(&m_channel_config4);
	nrf_drv_adc_channel_enable(&m_channel_config5);
    nrf_drv_adc_channel_enable(&m_channel_config6);
	nrf_drv_adc_channel_enable(&m_channel_config7);	
}

I've try to change CONN_SUP_TIMEOUT from MSEC_TO_UNITS(4000, UNIT_10_MS)  to BLE_GAP_CP_CONN_SUP_TIMEOUT_MAX , or increase MAX_CONN_INTERVAL still disconnected.

The only way I can make system keep connected is NOT to sample 8 channels, only sample 1 channel is fine  (But if set to 2 channels, system still disconnected soon after connected)

Is there any way or what parameter setting to make system keep BLE connected with 8 channels ADC sampling? 

Parents Reply
  • Hi Edvin,

    Yes, I used "APP_TIMER_DEF(m_adc_timer_id);" as timer source, and enable timer in timers_init(). I change my sampling method , not to sample 8 channels at one time, but sample only 1 channel each timer interrupt reached and next channel for next time event, .... Shorten sample rate to div 8 to get the same performance, it seems solved. I will close this ticket.

    Thanks for your kindly help and reply.

Children
No Data
Related