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

Advertising parameters for long range

Hello,

I am trying to understand the parameters required for Coded PHY.  This is from my advertising_init function in main.c:



I have encountered this advertising_init function in main.c. I had seen this type parameter structure from some code examples in forum  :



I have checked my advertising.c file and saw parameters above in uint32_t ble_advertising_init. I am confused a bit.

So what is the difference between them ? I am asking because I am told that the advertising type must be set to BLE_GAP_ADV_TYPE_EXTENDED_CONNECTABLE_NONSCANNABLE_UNDIRECTED for long range. Do I need to set advertising type in main.c  or in advertising.c ? 

Best Regards

  • Hi

    The extended advertising module is restricted to either be scannable or connectable, which is a necessary part of Coded PHY. So yes, in order to use Coded PHY (long-range mode) you have to either set the advertising type to either scannable+nonconnectable or nonscannable+connectable, depending on whether your device is going to connect to a central or just advertise data.

    Best regards,

    Simon

  • One or maybe a few peripheral device will connect to central device in long range. In that case I must set nonscannable+connecable.
    Should I set advertising type in main.c in advertising_init function I shared or in advertising.c ?

  • Correct, nonscannable+connectable would be the type to go for.

    This should be set in your advertising_init() function in main.c as that is the advertising initialization you're using in your application.

    Best regards,

    Simon

  • Okay I set  BLE_GAP_ADV_TYPE_EXTENDED_CONNECTABLE_NONSCANNABLE_UNDIRECTED like this:


    I would like to ask something. In the first code I shared, ble_adv_modes_config_t members are used and in the second code, ble_gap_adv_params_t members are used. Do I need to use all of them for long range ? For example, I used init.config.ble_adv_primary_phy = BLE_GAP_PHY_CODED and init.config.ble_adv_secondary_phy = BLE_GAP_PHY_CODED for long range and it is working. Also adv_params.primary_phy  = BLE_GAP_PHY_CODED and adv_params.secondary_phy  = BLE_GAP_PHY_CODED are used for long range operation. Should I use both init.config and adv_params members in advertising_init() function at the same time ?

    Best Regards

  • Hi

    No, you don't need to state the PHY twice, I suggest removing the adv_params.primary_phy and secondary_phy defines. and leave the init.config ones be.

    Best regards,

    Simon