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

sd_ble_gap_connect with BLE_GAP_PHY_2MBPS causes SOFTDEVICE: ASSERTION FAILED

I'm trying to completely understand extended advertisements and what is possible when initiating a connection to a device advertising using extended advertisements.  I'm using an nRF52840-QIAAC0 with SDK15 and S140 6.1.0.  I have a device advertising BLE_GAP_ADV_TYPE_EXTENDED_CONNECTABLE_NONSCANNABLE_UNDIRECTED with the primary PHY set to BLE_GAP_PHY_1MBPS and the secondary PHY set to BLE_GAP_PHY_2MBPS. 

The documentation for ble_gap_adv_params_t::secondary_phy states: "If @ref ble_gap_adv_properties_t::type is an extended advertising type and connectable, this is the PHY that will be used to establish a connection and send AUX_ADV_IND packets on."  So with my configuration I would assume the connection would be established on the 2Mbps PHY.  So on the initiator side I set ble_gap_scan_params_t::scan_phys to BLE_GAP_PHY_2MBPS, but when I call sd_ble_gap_connect I get a SOFTDEVICE: ASSERTION FAILED error.  Should this work? 

According to the ble_gap_scan_params_t::scan_phys documentation it seems like it should: "When used with @ref sd_ble_gap_connect, the bitfield indicates the PHYs on where a connection may be initiated.  If scan_phys contains @ref BLE_GAP_PHY_1MBPS and/or @ref BLE_GAP_PHY_2MBPS, the primary scan PHY is @ref BLE_GAP_PHY_1MBPS."

If I set scan_phys to BLE_GAP_PHY_1MBPS it works and the connection is established, but I'm not sure what PHY I'm actually connected on.  I would expect it to be 2Mbps, but I'm not sure.  Is there anyway to find out the current PHY for a connection?

Thanks,

John

  • Hi,

    Thank you for reporting this softdevice assertion.

    but when I call sd_ble_gap_connect I get a SOFTDEVICE: ASSERTION FAILED error.  Should this work? 

    I think that the function should have returned NRF_ERROR_INVALID_PARAM in this case. I will add a new reply here when I have verified this.

    The scan_phys is used for the primary advertising channels. The scanner will accept all types of PHY’s for the secondary advertising channel PHYs, independent on the PHYs used in scan_phys. So the connection will be established on the secondary_phy, even if the secondary_phy is not a part of the scan_phys. So yes, you are connected on 2MBPS.
    The scanner can see what the secondary_phy is set to in the advertising report. To know what phy you are currently on, you can try to do a phy update to the phy that you would like to use.

    Update:
    The API documentation states that scan_phys may be set to 2MBPS. If the SoftDevice assert for this configuration, this means that it is a SoftDevice bug. This bug does however not restrict any use-cases because 2Mbps is not used in scanning anyways. It was allowed in the API only to simplify application code.

  • Hi Sigurd,

    I would suggest maybe just changing the API documentation, because it seems like the sd_ble_gap_connect case behaves just like the sd_ble_gap_scan_start case where you're basically just setting what primary phys will be used during scanning.  Unless the intent was to allow the user to not allow connections to be made on the 2Mbps phy by leaving it out of scan_phys in the sd_ble_gap_connect case, but it doesn't seem to behave that way currently.

    John

Related