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

GAP Broadcast

Hi,

I have nRF52 dev boards (nRF52840) (PCA10056), I am using SoftDevice nRF5_SDK_17.0.2_d674dde.

I am not sure SoftDevice SDK 17.0.2 supports BLE 5.0 specification:

    9.1 BROADCAST MODE AND OBSERVATION PROCEDURE

    9.5 PERIODIC ADVERTISING MODES AND PROCEDURE

If yes, is there any code example available,

if no, is it possible to customize (or extend or user-add ) function to SoftDevice for such a function/implementation?

Thank you

David

Parents
  • Hi David,

    Broadcasting is essentially just non-connectable advertising, and this is supported. Observation, is just receiving/reading  broadcasted (connection less) data, i.e. advertisement packets. Any SoftDevice that supports the peripheral role can do broadcasting, and any SoftDevice that supports the central role can do scanning/observing.

    Periodic advertisement is a bit different, and that is not supported by any SoftDevice, and it is not possible to achieve this with just adding features in the application. If you need periodic advertisement support then you should consider the nRF Connect SDK (see Bluetooth: Periodic Advertising sample).

    Einar

  • Hi Einar,

    Thank you for your reply.

    Two things I would like to get more clarification.

    1). Broadcasting is non-connectable advertising. But in my mind, it may be not just advertising. Advertising is only on 3 primary channels. If I can use secondary channels with non-connectable advertising capability ( observer and advertisers specify a channel. Or just like UDP on any channels ). It will help our application. (It may be up to 100 nodes)

    2).I thought you have a set of libraries supports application development instead of using SoftDevice. My understanding is code from library is statically linked into application, while SoftDevice is dynamically linked. If so, is it the same to use library comparing to softdevice in term of functionality?  I believe it will reduce RAM usage, which will result lower power consumption. Is it possible to do so and disable the SoftDevice or not event to be loaded into the device with everything supported, such as OTA DFU?

    Thank you,

    David

  • Hi David.

    1) The concept you asked about initially has existed since the introduction of BLE in Bluetooth 4.0. However, you are right that you can use more than the 3 channels if you use the advertising extensions that came with Bluetooth 5, but only a subset is supported by the SoftDevice. With that you can also use longer advertisement packets on the secondary channels (255 bytes). There is no example of this in the SDK, though.

    2) With the nRF5 SDK we do not provide any other BLE stack than the SoftDevice, and that is only distributed in binary form (though in server variants). If you need more flexibility, then you should look at the nRF Connect SDK (NCS). As mentioned, here the Bluetooth stack in NCS also support periodic advertising. Unless you want to develop your own Bluetooth stack that is where you need to look for periodic advertising.

  • HI Einar,

    Thank you for your explanation.

    1) I am not sure I can request a very simple demo sample for using advertising extenstions, just to demonstrate to use a secondary channel. (from beginning to end on a secondary channel, or need a primary first, then it can use  secondary, etc.?).  It doesn't need to be fully test, just to show some steps and skeleton codes, compiled it with SDK V17.02, which will help me a lot. I can do testing my self.

    2). We started with Zyphr (NCS), but now we are under linux. I believe we cannot use nRFConnect SDK.

    Thank you,

    David

  • Hi Einar,

    I briefly went through softDevice API (library). I found that extended types defined for s132/s140 are

    #define BLE_GAP_ADV_TYPE_EXTENDED_CONNECTABLE_NONSCANNABLE_UNDIRECTED       0x06   /**< Connectable non-scannable undirected advertising
                                                                                            events using extended advertising PDUs. */
    #define BLE_GAP_ADV_TYPE_EXTENDED_CONNECTABLE_NONSCANNABLE_DIRECTED         0x07   /**< Connectable non-scannable directed advertising
                                                                                            events using extended advertising PDUs. */
    #define BLE_GAP_ADV_TYPE_EXTENDED_NONCONNECTABLE_SCANNABLE_UNDIRECTED       0x08   /**< Non-connectable scannable undirected advertising
                                                                                            events using extended advertising PDUs.
                                                                                            @note Only scan response data is supported. */
    #define BLE_GAP_ADV_TYPE_EXTENDED_NONCONNECTABLE_SCANNABLE_DIRECTED         0x09   /**< Non-connectable scannable directed advertising
                                                                                            events using extended advertising PDUs.
                                                                                            @note Only scan response data is supported. */
    #define BLE_GAP_ADV_TYPE_EXTENDED_NONCONNECTABLE_NONSCANNABLE_UNDIRECTED    0x0A   /**< Non-connectable non-scannable undirected advertising
                                                                                            events using extended advertising PDUs. */
    #define BLE_GAP_ADV_TYPE_EXTENDED_NONCONNECTABLE_NONSCANNABLE_DIRECTED      0x0B   /**< Non-connectable non-scannable directed advertising
                                                                                            events using extended advertising PDUs. */

    But only BLE_GAP_ADV_TYPE_EXTENDED_CONNECTABLE_NONSCANNABLE_UNDIRECTED

    is coded in the ble_advertising.c:

    static ret_code_t set_adv_mode_slow(...)
    static ret_code_t set_adv_mode_fast(...)
    {
    #if !defined (S112) && !defined(S312) && !defined(S113)
        if (p_advertising->adv_modes_config.ble_adv_extended_enabled)
        {
            p_advertising->adv_params.properties.type = BLE_GAP_ADV_TYPE_EXTENDED_CONNECTABLE_NONSCANNABLE_UNDIRECTED;
        }
    ...
        return NRF_SUCCESS;
    }

    Other extended adv types are not implemented in the SoftDevice (SDK v17), which means it cannot be on secondary channels even though it is extended. Correct me if I am wrong.

    Thank you,

    David

Reply
  • Hi Einar,

    I briefly went through softDevice API (library). I found that extended types defined for s132/s140 are

    #define BLE_GAP_ADV_TYPE_EXTENDED_CONNECTABLE_NONSCANNABLE_UNDIRECTED       0x06   /**< Connectable non-scannable undirected advertising
                                                                                            events using extended advertising PDUs. */
    #define BLE_GAP_ADV_TYPE_EXTENDED_CONNECTABLE_NONSCANNABLE_DIRECTED         0x07   /**< Connectable non-scannable directed advertising
                                                                                            events using extended advertising PDUs. */
    #define BLE_GAP_ADV_TYPE_EXTENDED_NONCONNECTABLE_SCANNABLE_UNDIRECTED       0x08   /**< Non-connectable scannable undirected advertising
                                                                                            events using extended advertising PDUs.
                                                                                            @note Only scan response data is supported. */
    #define BLE_GAP_ADV_TYPE_EXTENDED_NONCONNECTABLE_SCANNABLE_DIRECTED         0x09   /**< Non-connectable scannable directed advertising
                                                                                            events using extended advertising PDUs.
                                                                                            @note Only scan response data is supported. */
    #define BLE_GAP_ADV_TYPE_EXTENDED_NONCONNECTABLE_NONSCANNABLE_UNDIRECTED    0x0A   /**< Non-connectable non-scannable undirected advertising
                                                                                            events using extended advertising PDUs. */
    #define BLE_GAP_ADV_TYPE_EXTENDED_NONCONNECTABLE_NONSCANNABLE_DIRECTED      0x0B   /**< Non-connectable non-scannable directed advertising
                                                                                            events using extended advertising PDUs. */

    But only BLE_GAP_ADV_TYPE_EXTENDED_CONNECTABLE_NONSCANNABLE_UNDIRECTED

    is coded in the ble_advertising.c:

    static ret_code_t set_adv_mode_slow(...)
    static ret_code_t set_adv_mode_fast(...)
    {
    #if !defined (S112) && !defined(S312) && !defined(S113)
        if (p_advertising->adv_modes_config.ble_adv_extended_enabled)
        {
            p_advertising->adv_params.properties.type = BLE_GAP_ADV_TYPE_EXTENDED_CONNECTABLE_NONSCANNABLE_UNDIRECTED;
        }
    ...
        return NRF_SUCCESS;
    }

    Other extended adv types are not implemented in the SoftDevice (SDK v17), which means it cannot be on secondary channels even though it is extended. Correct me if I am wrong.

    Thank you,

    David

Children
  • Hi David,

    Yes, you are right. NCS is really what you want to consider if you want many extended advertising features. Also, this is where you can expect new features to be added in the future.

    Please note that NCS is fully supported with Linux (as well as Windows and macOS), and a significant portion of Nordic firmware developers (most likely majority) uses Linux.

  • Hi Einar,

    Thank you for your reply.

    CAN I use NCS to program nRF52840/nRF5232 device? I thought NCS is for Zephyr Host or Linux Host, not for nRF52840/nRF52832 devices.

    Using SoftDevice, if a central is connected to a peripheral, it can accept periodic data broadcasting from the perpheral. But if the peripheral is stopped (not running or too far away), then the connection is broken, and it seems removed (service) from the central. Is there a way to fake it. i.e. to keep the broken connection, and if the peripheral backs on again, it can automatically resume data broadcast without a re-connection?

    Regards,

    David

  • Hi David,

    TigerD said:
    CAN I use NCS to program nRF52840/nRF5232 device?

    Yes. NCS is a full SDK that supports all devices in the nRF2 series (as well as nRF5340 and nRF9060). This is the SDK Nordic supplies going forward. The nRF5 SDK is in more of a maintenance mode and you should not expect new features here.

    TigerD said:
    I thought NCS is for Zephyr Host or Linux Host, not for nRF52840/nRF52832 devices.

    No, that is not the case. See nRF Connect SDK (and here for more technical documentation).

    TigerD said:
    Using SoftDevice, if a central is connected to a peripheral, it can accept periodic data broadcasting from the perpheral. But if the peripheral is stopped (not running or too far away), then the connection is broken, and it seems removed (service) from the central. Is there a way to fake it. i.e. to keep the broken connection, and if the peripheral backs on again, it can automatically resume data broadcast without a re-connection?

    Periodic advertising is not supported by the SoftDevice (and probably never will be), so this will not work in any case.

    Einar

  • HI Einar,

    I installed nRFConnectSDK, compiled a beacon project, loaded into nRF52840 device. It runs.

    But I cannot measure the power consumption using nRF9160 Power Measurement DK board. I selected the nRF52840 board, but cannot start RUN and measure. Did I miss anything?

    Thank you,

    David Z

  • Hi David,

    I assume you are referring to the Power Profiler Kit (first or second version)? In any case please open a new case about issues using those as that is different than previous topics in this thread. When you do, please explain in what way it does not work, how you have configured it and hooked it up, etc.

Related