Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Inquiry about SDK15

hello, everyone.

I have to immigrate from SDK14 to SDK15.

I have some inquiries my project ( I will configure Transmitter(Beacon) and Receiver)

First, I have configured Advertising with Scan Response on the transmitter. The receiver scan and handle advertising+scanRSP data through the advertising report in SDK14.

However, In the SDK15, The structure seems to have changed.

I distinguished Adv data and RSP data by checking this code.  [ p_adv_report->scan_rsp == ? ] 

How do I change it in SDK 15?

Second, I want to test the long range mode.

So,  I have added primary_phy and secondary_phy. But, When the primary_phy is BLE_GAP_PHY_CODED, It returns error.

However, When the primary_phy was BLE_GAP_PHY_1MBPS, it worked well.

So, should I set the primary_phy to 1MBPS and change it as an event?

I would appreciate it if you could give me a good solution. Thanks

Regards,

Lee

Parents
  • Hi Lee,

    Have you taken a look at the migration documentation to migrate from sdk 14.2 to sdk 15? Also, I would recommend taking a look at this long range demo blog post from Nordic, which explains coded phy well. In addition, here is the att mtu example, on which the long range demo is based.

  • Yes, I saw. In the attmtu example, changing primary phy to coded phy returned in an errror.

    Is coded phy changeable after it is triggered by an event? I wonder if it is necessary to change step by step event if only the long range mode is used.

  • Please understand that I am not a complete expert in F/W.

    I have changed primary phy to coded phy. And then this situation was discovered.

  • Did you change the primary phy to BLE_GAP_PHY_CODED in the advertising_data_set() function in main.c?

    Could you upload the code snippets where you changed the primary phy to BLE_GAP_PHY_CODED? Also, did you leave the secondary phy at BLE_GAP_PHY_1MBPS or did you changed it to coded phy too?

    If you take a look at this github example, you notice that the peripheral uart advertises over long range & the central uart example will connect over long range. This can be seen by looking at the m_scan_params variable in ble app uart central project in main.c:

    /**@brief Scan parameters requested for scanning and connection. */
    static ble_gap_scan_params_t m_scan_params =
    {
        .active            = 0,
        .interval          = SCAN_INTERVAL,
        .window            = SCAN_WINDOW,
        .filter_policy     = BLE_GAP_SCAN_FP_ACCEPT_ALL,
        .filter_duplicates = BLE_GAP_SCAN_DUPLICATES_REPORT,
        .scan_phy          = BLE_GAP_PHY_CODED,
        .duration          = SCAN_TIMEOUT,
        .period            = 0x0000, // No period.
    };

    The advertising_start() function has been updated here in the uart peripheral example:

    static void advertising_start(void)
    {
        static ble_gap_adv_params_t adv_params = {0};
        
        adv_params.properties.connectable = 1;
        // Setting up the scan response packet is currently not supported when using CODED phy
        adv_params.properties.scannable = 0;    
        adv_params.properties.legacy_pdu = 0;
        adv_params.p_peer_addr   = NULL;
        adv_params.fp            = BLE_GAP_ADV_FP_ANY;
        adv_params.interval      = APP_ADV_INTERVAL;
        adv_params.duration      = APP_ADV_TIMEOUT_IN_SECONDS * 100;
    #if defined(S140)
        adv_params.primary_phy   = BLE_GAP_PHY_CODED;
        adv_params.secondary_phy = BLE_GAP_PHY_CODED;
    #else
        adv_params.primary_phy   = BLE_GAP_PHY_1MBPS;
        adv_params.secondary_phy = BLE_GAP_PHY_1MBPS;
    #endif
    
        NRF_LOG_INFO("Starting advertising.");
    
        ret_code_t err_code = sd_ble_gap_adv_start(BLE_GAP_ADV_SET_HANDLE_DEFAULT, &adv_params, APP_BLE_CONN_CFG_TAG);
        APP_ERROR_CHECK(err_code);
    }

    In the att_mtu central & peripheral example, the phy can be changed via the command line using this function here:

    static void phy_set(nrf_cli_t const * p_cli, uint8_t value)
    {
        ble_gap_phys_t phy =
        {
            .rx_phys = value,
            .tx_phys = value,
        };
    
        preferred_phy_set(&phy);
        nrf_cli_fprintf(p_cli, NRF_CLI_NORMAL, "Preferred PHY set to %s.\r\n", phy_str(phy));
    }

Reply
  • Did you change the primary phy to BLE_GAP_PHY_CODED in the advertising_data_set() function in main.c?

    Could you upload the code snippets where you changed the primary phy to BLE_GAP_PHY_CODED? Also, did you leave the secondary phy at BLE_GAP_PHY_1MBPS or did you changed it to coded phy too?

    If you take a look at this github example, you notice that the peripheral uart advertises over long range & the central uart example will connect over long range. This can be seen by looking at the m_scan_params variable in ble app uart central project in main.c:

    /**@brief Scan parameters requested for scanning and connection. */
    static ble_gap_scan_params_t m_scan_params =
    {
        .active            = 0,
        .interval          = SCAN_INTERVAL,
        .window            = SCAN_WINDOW,
        .filter_policy     = BLE_GAP_SCAN_FP_ACCEPT_ALL,
        .filter_duplicates = BLE_GAP_SCAN_DUPLICATES_REPORT,
        .scan_phy          = BLE_GAP_PHY_CODED,
        .duration          = SCAN_TIMEOUT,
        .period            = 0x0000, // No period.
    };

    The advertising_start() function has been updated here in the uart peripheral example:

    static void advertising_start(void)
    {
        static ble_gap_adv_params_t adv_params = {0};
        
        adv_params.properties.connectable = 1;
        // Setting up the scan response packet is currently not supported when using CODED phy
        adv_params.properties.scannable = 0;    
        adv_params.properties.legacy_pdu = 0;
        adv_params.p_peer_addr   = NULL;
        adv_params.fp            = BLE_GAP_ADV_FP_ANY;
        adv_params.interval      = APP_ADV_INTERVAL;
        adv_params.duration      = APP_ADV_TIMEOUT_IN_SECONDS * 100;
    #if defined(S140)
        adv_params.primary_phy   = BLE_GAP_PHY_CODED;
        adv_params.secondary_phy = BLE_GAP_PHY_CODED;
    #else
        adv_params.primary_phy   = BLE_GAP_PHY_1MBPS;
        adv_params.secondary_phy = BLE_GAP_PHY_1MBPS;
    #endif
    
        NRF_LOG_INFO("Starting advertising.");
    
        ret_code_t err_code = sd_ble_gap_adv_start(BLE_GAP_ADV_SET_HANDLE_DEFAULT, &adv_params, APP_BLE_CONN_CFG_TAG);
        APP_ERROR_CHECK(err_code);
    }

    In the att_mtu central & peripheral example, the phy can be changed via the command line using this function here:

    static void phy_set(nrf_cli_t const * p_cli, uint8_t value)
    {
        ble_gap_phys_t phy =
        {
            .rx_phys = value,
            .tx_phys = value,
        };
    
        preferred_phy_set(&phy);
        nrf_cli_fprintf(p_cli, NRF_CLI_NORMAL, "Preferred PHY set to %s.\r\n", phy_str(phy));
    }

Children
No Data
Related