nRF52 connection parameters for multilink -- PART II

Hi,

Follow up with previous thread. I'm still working 1 central vs 9 peripheral project but still sufferering packet loss. I'll describe both central and peripheral configurations below, please let me know if I misunderstand any part of it.

Since peripheral 1 has largest data rate among all 9 peripherals, so connection parameters for all devices are aligned with peripheral 1. 

Peripheral 1 setups:

  • Connection event length extension ENABLED
  • Generate 131Bytes packet every 20ms and send with API -- ble_nus_data_send();
  • Connection interval range is set to 7.5ms~200ms
  • Gap_evt_length is set to 16(20ms)

             

So I'm thinking of setting the connection interval to 200ms and set aside 20ms for each peripheral connection. According to power profiler, 20ms alows 1757Bytes transmitting via 1M PHY. Since peripheral 1 will generate 10 packets(10 * 131Bytes = 1310Byte in total) during 200ms interval. Thus 20ms gap_event _length could totally cover the peripheral 1 data transferring. Aligned the rest peripherals with peripheral 1, the total gap_evt_length would be 9 * 20ms = 180ms. Allocate 10ms for scan window and reserve the rest 10ms as margin.

With above thinking, the central is configured as:

  • Connection event length extension ENABLED
  • Scan and connectoin parameters configurations:

                      

But I'm still sufferring from severe packet lost with such settings. Did I miss any key parameters for multilink applicaiton, like slave latency? Or did I mistakenly calculate the parameter units?

Thanks!

Parents Reply Children
  • Are you getting any errors returned from ble_nus_data_send()? e.g. NRF_ERROR_RESOURCES ?

  • Hi,

    Are you getting any errors returned from ble_nus_data_send()

    I can't tell yet because peripherals are custom boards. But I've added some error check mechanism while sending:

    void ble_data_send_with_queue(void)
    {
    	static buffer_t m_buf;
    	uint32_t err_code;
    	uint16_t length = 0;
    	static bool retry = false;
    	
    	
    	if (retry)
    	{
    		length = m_buf.length;
    		err_code = ble_nus_data_send(&m_nus, m_buf.data_array, &length, m_conn_handle);
    		if ( (err_code != NRF_ERROR_INVALID_STATE) && (err_code != NRF_ERROR_RESOURCES) &&
    				 (err_code != NRF_ERROR_NOT_FOUND) )
    		{
    //				APP_ERROR_CHECK(err_code);
    		}
    		if (err_code == NRF_SUCCESS)
    		{
    			retry = false;
    		}
    	}
    	
    	//If queue is not empty & retry is true
    	while(!nrf_queue_is_empty(&m_buf_queue) && !retry)
    	{
    		err_code = nrf_queue_pop(&m_buf_queue, &m_buf);
    		APP_ERROR_CHECK(err_code);		
    		length = m_buf.length;
    					
    		err_code = ble_nus_data_send(&m_nus, m_buf.data_array, &length, m_conn_handle);
    		if ( (err_code != NRF_ERROR_INVALID_STATE) && (err_code != NRF_ERROR_RESOURCES) &&
    				 (err_code != NRF_ERROR_NOT_FOUND) )
    		{
    //				APP_ERROR_CHECK(err_code);
    		}
    		if (err_code == NRF_SUCCESS)
    		{
    			retry = false;
    		}
    		else
    		{
    			retry = true;
    			break;
    		}
    	}			
    }

    This function is placed in a 10ms timer handler and nus_data_handler while event type is BLE_NUS_EVT_TX_RDY.

    ---------------------------------------------------------------------------------------------------------------------------------------------

    If it helps, I did another test.

    I applied 80ms connection interval; 7.5ms gap_event_length on both 1v1 and 1v9 central(1v9 central is modified from 1v1 central), the former works fine but the latter had packet loss. The 1v9 has address filter and I only added one valid address, the rest 8 were dummy address.

    Thanks

  • Avadacadabara said:
    I can't tell yet because peripherals are custom boards.

    Ok, try adding some printing, e.g. with nrf_log and use Segger RTT backend as logger backend

Related