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

Advertisement packet loss in Coded PHY vs 1 Mb PHY

Using the following:

Rigado BMD-360 nRF52811 development board.

Softdevice S140 7.0.1

SDK 16.0

Using two development boards inches apart, one development board sends a single advertising event every 12 seconds.  The other development board is continuously scanning (interval and window = 7s).  The packets have 30 bytes of data including a sequence number.  I calculated packet loss based on the missing sequence numbers.

Sending and scanning using the 1 MB/s PHY, in a test of approx. 20 minutes  I get 100% reception of packets.

Sending and scanning using the Coded PHY, in the same test I get ~43% reception of packets, ~57% packet loss.

Is this expected behavior, or could I be configuring something wrong when advertising using Coded PHY?

Another behavior I've seen is for the above condition using the Coded PHY to have a repeating pattern of receiving 3 and missing 2.

Parents
  • Thank you for the update Kurt

    This seems very strange indeed. You should have a much larger success rate with the setup you're describing. Coded PHY should definitely not be losing this many packets compared to the other PHY(s). Can you show me how your advertising initialization function looks? 

    You can also take a look at this example, where the ble_app_uart and ble_app_uart_c projects have been modified to use Coded PHY. Please keep in mind that you should set the advertising flag to GENERAL_DISC_MODE in this example to make it work properly.

    Long_range_15.2.zip

    Best regards,

    Simon

Reply
  • Thank you for the update Kurt

    This seems very strange indeed. You should have a much larger success rate with the setup you're describing. Coded PHY should definitely not be losing this many packets compared to the other PHY(s). Can you show me how your advertising initialization function looks? 

    You can also take a look at this example, where the ble_app_uart and ble_app_uart_c projects have been modified to use Coded PHY. Please keep in mind that you should set the advertising flag to GENERAL_DISC_MODE in this example to make it work properly.

    Long_range_15.2.zip

    Best regards,

    Simon

Children
  • Simon,

    After being pulled away to work on other things, I am investigating this further.

    I am now using custom boards as well as development boards.  Currently I am experiencing approximately 20% packet loss under the original conditions.

    I have attached snippets of the ble stack init and the advertising init.

    static void ble_stack_init(void)
    {
        ret_code_t err_code;
    
        err_code = nrf_sdh_enable_request();
        APP_ERROR_CHECK(err_code);
    
        // Configure the BLE stack using the default settings.
        // Fetch the start address of the application RAM.
        uint32_t ram_start = 0;
        err_code = nrf_sdh_ble_default_cfg_set(APP_BLE_CONN_CFG_TAG, &ram_start);
        APP_ERROR_CHECK(err_code);
    
        // Enable BLE stack.
        err_code = nrf_sdh_ble_enable(&ram_start);
        APP_ERROR_CHECK(err_code);
    
    }
    
    static void advertising_init(void)
    {
    
        ble_gap_adv_params_t m_adv_params;
        uint32_t      err_code;
        ble_advdata_t advdata;
        uint8_t       flags = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
    
        ble_advdata_manuf_data_t manuf_specific_data;
    
        manuf_specific_data.company_identifier = APP_COMPANY_IDENTIFIER;
    
        manuf_specific_data.data.p_data = (uint8_t *) binData;
        manuf_specific_data.data.size   = BIN_DATA_SIZE;
    
        // Build and set advertising data.
        memset(&advdata, 0, sizeof(advdata));
    
        advdata.name_type             = BLE_ADVDATA_NO_NAME;
        advdata.flags                 = flags;
        advdata.p_manuf_specific_data = &manuf_specific_data;
    
    ...
        // Initialize advertising parameters (used when starting advertising).
        memset(&m_adv_params, 0, sizeof(m_adv_params));
    
        m_adv_params.properties.type = BLE_GAP_ADV_TYPE_EXTENDED_CONNECTABLE_NONSCANNABLE_UNDIRECTED;
        m_adv_params.p_peer_addr     = NULL;    // Undirected advertisement.
        m_adv_params.filter_policy   = BLE_GAP_ADV_FP_ANY;
        m_adv_params.interval        = APP_ADV_INTERVAL;
        m_adv_params.duration        = APP_ADV_DURATION;
        m_adv_params.primary_phy	 = BLE_GAP_PHY_CODED;
        m_adv_params.secondary_phy	 = BLE_GAP_PHY_CODED;
        m_adv_params.max_adv_evts	 = NUM_ADV_EVENTS;
    
        err_code = ble_advdata_encode(&advdata, m_adv_data.adv_data.p_data, &m_adv_data.adv_data.len);
        if (err_code != NRF_SUCCESS)
    	printf("encode=%x\n", err_code);
    
        err_code = sd_ble_gap_adv_set_configure(&m_adv_handle, &m_adv_data, &m_adv_params);
        if (err_code != NRF_SUCCESS)
    	printf("cfg=%x\n", err_code);
        
        m_adv_data.adv_data.p_data[0] = 30;
        m_adv_data.adv_data.p_data[1] = 1;
        uint16_t *manuf_ptr = (uint16_t *)&m_adv_data.adv_data.p_data[2];
        *manuf_ptr = APP_COMPANY_IDENTIFIER;
    ...
        err_code = sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_ADV, m_adv_handle, TRANSMIT_POWER);
        if (err_code != NRF_SUCCESS)
    	printf("power set failed=%x\n", err_code);
    }
    

Related