Migrating ble_app_proximity example from SDK 17.1.0 to SDK 3.0.1

I have been using the SDK example ble_app_proximity to flash my demo boards nRF52840 to do some RF PHY testing on Bluetooth advertising.

It was very easy in this example to change the BLE advertising interval as well as the TX transmit power.

It was easy using the SEGGER IDE to re-build the example and flash the board.

Moving to the new SDK 2.x and 3.x, this example ble_app_proximity is no longer part of the nRF SDK.

Is there an equivalent simple example in the SDK 2.0, or SDK3.0 ?  

OS: Windows 10 and 11

HW: nRF52840DK, nRF5340DK

Regards

JM Gayet

  • Hello,

    Unfortunately, there is no ble_app_proximity equivalent in the nRF Connect SDK (NCS), and as far as I know, there aren't any plans on adding it anytime soon. 

    I am not sure what you are using your ble_app_proximity application for, but perhaps channel sounding can be something that you can use? NB: This only works with the nRF54L series, but if you are using the nRF52840 and nRF5340, then the distance measurement library may be of interest (NCS\nrf\samples\bluetooth\nrf_dm.

    If you need the ble_app_proximity functionality, I am afraid you would need to implement this service. It shouldn't be too complicated. We have a course called Nordic Devacademy, Bluetooth Low Energy Fundamentals. It does sound like you are familiar with Bluetooth Low Energy, but this is still a good introduction to the nRF Connect SDK (NCS), and how Bluetooth Services are implemented in NCS.

    If you are interested, you can find it here:

    https://academy.nordicsemi.com/courses/bluetooth-low-energy-fundamentals/

    Best regards,

    Edvin

  • Hi Edvin,

    Thank for answering my post.

    At the end I am looking for a basic Bluetooth LE example in the new SDK V3.0.2 from where I can set up the Advertising Interval and the transmit power. I don't need any other features. In the old SDK, I was using the ble_app_proximity example as it was very easy in the Segger IDE to change the Advertising Interval and the Transmit power.

    I am just using my Nordic dev kit nRF52840 and nRF5340 to do some RF PHY testing with my R&S CMW and CMP testers.

    At the end I am only using 2 Nordic app, the direct_test_mode and the ble_app_proximity. 

    The direct_test_mode app is still in the latest SDK 3.0.2 and work fine. 

    But for Advertising test, I need to find a simple app in the SDK 3.0.2.

    Let me know

    Best Regards

    JM Gayet 

  • Hello,

    My go to sample is the peripheral_uart, which is the equivalent to the ble_app_uart example in the old nRF5 SDK.

    Found in: NCS\nrf\samples\bluetooth\peripheral_uart

    The way that advertising interval and transmit power is set up is a bit different in the nRF Connect SDK (NCS). 

    Advertising:

    In this sample, the advertising is started in adv_work_handler() in main.c.

    int err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_2, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd));

    ad and sd are the arrays containing the advertising data and scan response data. 

    BT_LE_ADV_CONN_FAST_2 is a macro for advertising parameters. It is defined as connectable advertising, using an advertising interval between BT_GAP_ADV_FAST_INT_MIN_2 (100ms) and BT_GAP_ADV_FAST_INT_MAX_2 (150ms). 

    You can adjust these by changing adv_work_handler() from:

    static void adv_work_handler(struct k_work *work)
    {
    	int err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_2, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd));
    
    	if (err) {
    		LOG_ERR("Advertising failed to start (err %d)", err);
    		return;
    	}
    
    	LOG_INF("Advertising successfully started");
    }

    to:

    static void adv_work_handler(struct k_work *work)
    {
    	struct bt_le_adv_param my_adv_params =
    		BT_LE_ADV_PARAM_INIT(BT_LE_ADV_OPT_CONN,
    				     BT_GAP_ADV_FAST_INT_MIN_2,
    				     BT_GAP_ADV_FAST_INT_MAX_2,
    				     NULL);
    	int err = bt_le_adv_start(&my_adv_params, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd));
    
    	if (err) {
    		LOG_ERR("Advertising failed to start (err %d)", err);
    		return;
    	}
    
    	LOG_INF("Advertising successfully started");
    }

    And there you can change the parameters individually. Although the declaration of bt_le_adv_param states that the minimum and maximum advertising interval should not be the same value, it does build and run if you do that. 

    Regarding the transmit power, this can be set build time using this Kconfig in your prj.conf file:

    CONFIG_BT_CTLR_TX_PWR_0=y

    You can see the supported values in the file NCS\zephyr\subsys\bluetooth\controller\kconfig. Values like CONFIG_BT_CTLR_TX_PWR_PLUS_4 and BT_CTLR_TX_PWR_MINUS_4 are examples of supported values. It needs to match one of the values from the TXPOWER register of the device you are using:

    https://docs.nordicsemi.com/bundle/ps_nrf52840/page/radio.html#ariaid-title70

    Best regards,

    Edvin

  • Hi Edvin,

    I was able to modify the preipheral_uart example and set the Advertising Interval parameters to 20 ms .. 40 ms.

    I can see the DUT Averstising between 20 to 30 ms on the PHY layer which is great.

    I was also able to change the power adding the directive CONFIG_BT_CTLR_TX_PWR_PLUS_4=y in the prj.conf file.

    Thank a lot for your help

    [s: I did receive 2 nRF54L15 DK today. Now I need to find a working SDK for the Direct test Mode example. The build failed as it looks it is missing a file in the SDK V3.0.2. ...

    Regards

    JM Gayet

  • Hello,

    gayetprimo said:
    [s: I did receive 2 nRF54L15 DK today. Now I need to find a working SDK for the Direct test Mode example. The build failed as it looks it is missing a file in the SDK V3.0.2. ...

    What build error did you see? On my side, it builds without any errors or warnings.

    What is the build command that you used?

    Did you test it with NCS v3.1.0 which was released on Thursday?

    (I tested both v3.0.2 and v3.1.0 without issues on my side)

    Best regards,

    Edvin

Related