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

Advertising interferes with advertising in non-whitelisted mode

Hello,

We use the nRF52832 with SD 17.2.0, Bluetooth LE.

We observe an error when doing the following sequence:

- Build a bonded connection using the nRF Connect app.

- Trigger a disconnect.

- Trigger non-whitelisted advertising (via a button press but that should not matter) using the function 

err_code = ble_advertising_restart_without_whitelist(&m_advertising);

The disconnect triggers the advertising with whitelist while the non-whitelisted advertising is triggered at the same time and then the following error appears in the logs:

[00:02:15.000,000] <error> app: ERROR 7 [NRF_ERROR_INVALID_PARAM] at :0
PC at: 0x00000000
[00:02:15.000,000] <error> app: End of error report
[00:02:15.000,000] <warning> app: System reset

It also happens when triggering advertising wih the whitelist upon button press:

ble_advertising_start(&m_advertising, BLE_ADV_MODE_FAST);

How can we prevent this to happen?

Parents
  • Hello,

    I am not sure I understood correctly, but is the issue that you are starting your advertisements from two places at once? That typically triggers an NRF_ERROR_INVALID_STATE, and not the NRF_ERROR_INVALID_PARAM, but in case that is the issue, try adding the following option in your advertising_init() function:

    init.config.ble_adv_on_disconnect_disabled = true;

    If that is not the issue, then there is something wrong with your advertising set.Try to debug ble_advertising_start() and ble_advertising_restart_without_whitelist() and see what function call that returns the value NRF_ERROR_INVALID_PARAM.

    Best regards,

    Edvin

  • Hello,

    yes, that is the problem. 

    Disabling the advertising on disconnects prevents the error from happening. But we actually need the functionality to advertise upon disconnect. 

    When debugging, the problem arises in the function:

    (void) sd_ble_gap_adv_stop(p_advertising->adv_handle);
  • I need to correct myself, the debugger gave the error earlier. With debugging over logging, the error happens in the function 

    ret = flags_set(p_advertising, BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE); 

    inside
    uint32_t ble_advertising_restart_without_whitelist(ble_advertising_t * const p_advertising)
  • What call inside ble_advertising_restart_without_whitelist() returns NRF_ERROR_INVALID_PARAM?

  • The call to flags_set:

    static ret_code_t flags_set(ble_advertising_t * const p_advertising, uint8_t flags)

    So I have seen the description of the invalid param:
    * @retval ::NRF_ERROR_INVALID_PARAM                   Invalid parameter(s) supplied:
    * - Invalid advertising data configuration specified. See @ref ble_gap_adv_data_t.
    * - Invalid configuration of p_adv_params. See @ref ble_gap_adv_params_t.
    * - Use of whitelist requested but whitelist has not been set,
    * see @ref sd_ble_gap_whitelist_set.




    But the configuration is right because otherwise the advertising would not work at all if I get this right. And also the whitelist has been set when the error happens.
Reply
  • The call to flags_set:

    static ret_code_t flags_set(ble_advertising_t * const p_advertising, uint8_t flags)

    So I have seen the description of the invalid param:
    * @retval ::NRF_ERROR_INVALID_PARAM                   Invalid parameter(s) supplied:
    * - Invalid advertising data configuration specified. See @ref ble_gap_adv_data_t.
    * - Invalid configuration of p_adv_params. See @ref ble_gap_adv_params_t.
    * - Use of whitelist requested but whitelist has not been set,
    * see @ref sd_ble_gap_whitelist_set.




    But the configuration is right because otherwise the advertising would not work at all if I get this right. And also the whitelist has been set when the error happens.
Children
No Data
Related