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

CODED PHY using the BLE Advertising module - INVALID PARAMS

Hi! I'm using S140 and I'm using the ble_advertising module to set up advertising.

This is my advertising_init function which is working properly until I uncomment the enabling of the extended advertising. When executing advertising_start, an INVALID_PARAMS error gets thrown in the sd_ble_gap_adv_set_configure function which by the docs points at an invalid adv_params or adv_data. I've verified through the debugger that in adv_params passed into this function, properties->type is set to 0x06 (BLE_GAP_ADV_TYPE_EXTENDED_CONNECTABLE_NONSCANNABLE_UNDIRECTED).

On first glance it looks a lot like https://devzone.nordicsemi.com/f/nordic-q-a/34543/ble-long-range but seeing how in my case the type is set correctly, I'm at a bit of an ends on how to proceed. I can't seem to step further into the functions to see what part of my adv_params or adv_data is invalid. 

/**@brief Function for initializing the Advertising functionality.
 */
static void advertising_init(uint16_t interval_ms)
{
    ret_code_t             err_code;
    ble_advertising_init_t init;
    memset(&init, 0, sizeof(init));
    NRF_LOG_INFO("Initializing advertising with interval %d", interval_ms);

    init.advdata = get_prox_advdata();
    
    init.srdata.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]);
    init.srdata.uuids_complete.p_uuids  = m_adv_uuids;

    init.config.ble_adv_fast_enabled  = true;
    init.config.ble_adv_fast_interval = MSEC_TO_UNITS(interval_ms, UNIT_0_625_MS);
    init.config.ble_adv_fast_timeout  = 0; //Set advertising to permanent

    //init.config.ble_adv_extended_enabled = true;
    //init.config.ble_adv_primary_phy = BLE_GAP_PHY_CODED;
    //init.config.ble_adv_secondary_phy   = BLE_GAP_PHY_CODED;
   
    init.evt_handler = on_adv_evt;

    err_code = ble_advertising_init(&m_advertising, &init);
    APP_ERROR_CHECK(err_code);

    ble_advertising_conn_cfg_tag_set(&m_advertising, APP_BLE_CONN_CFG_TAG);
}

Parents
  • With SDK 16.0.0 & nRF52840 DK, in ble_app_uart example, does this advertising_init() enable CODED PHY ?
    No other code changes. I made these changes by looking at older posts in the devzone. My program does not crash(no Assert) and I don't see this peripheral device when I scan for BLE devices on my phone, as expected. I want to make sure if these changes are enough to use Coded PHY on peripheral.

    I am yet to edit ble_app_uart_c program to flash on another nRF52840 DK  to scan and connect with this peripheral.

    static void advertising_init(void)
    {
        uint32_t               err_code;
        ble_advertising_init_t init;
    
        memset(&init, 0, sizeof(init));
    
        init.advdata.name_type          = BLE_ADVDATA_FULL_NAME;
        init.advdata.include_appearance = false;
     // init.advdata.flags              = BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE;
            init.advdata.flags              =BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
    
     //   init.srdata.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]); // no scan response in Coded PHY
     //   init.srdata.uuids_complete.p_uuids  = m_adv_uuids;
            init.advdata.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]);
            init.advdata.uuids_complete.p_uuids  = m_adv_uuids;
    
        init.config.ble_adv_fast_enabled  = true;
        init.config.ble_adv_fast_interval = APP_ADV_INTERVAL;
        init.config.ble_adv_fast_timeout  = APP_ADV_DURATION;
                init.config.ble_adv_primary_phy       = BLE_GAP_PHY_CODED;  // use Coded PHY
                init.config.ble_adv_secondary_phy     = BLE_GAP_PHY_CODED;
                init.config.ble_adv_extended_enabled  = true;               // Coded PHY needs extended adv (bigger adv packet size)
        init.evt_handler = on_adv_evt;
    
        err_code = ble_advertising_init(&m_advertising, &init);
        APP_ERROR_CHECK(err_code);
    
        ble_advertising_conn_cfg_tag_set(&m_advertising, APP_BLE_CONN_CFG_TAG);
    }

Reply Children
No Data
Related