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);
  • 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.
  • I found out that calling the ble_advertising_restart_without_whitelist function is only problematic if the advertising mode is BLE_ADV_MODE_DIRECTED. Does that help any further?

  • Try setting it to undirected (BLE_ADV_MODE_FAST)

    How are you setting this in the first place, and where did you find the implementation to suggest it? I can't see any of the examples that do this by default.

    Best regards,

    Edvin

  • It is set in the init function - it is adapted from the examples and was not suggested. Disabling it prevents the problem from happening which is a possible solution in our case. 

    Out of interest: Shouldn't it work with the directed advertising as well?

    init.config.ble_adv_directed_enabled = true;
    init.config.ble_adv_directed_interval = APP_ADV_DIRECTED_INTERVAL;
    init.config.ble_adv_directed_timeout = APP_ADV_DIRECTED_DURATION;
Reply
  • It is set in the init function - it is adapted from the examples and was not suggested. Disabling it prevents the problem from happening which is a possible solution in our case. 

    Out of interest: Shouldn't it work with the directed advertising as well?

    init.config.ble_adv_directed_enabled = true;
    init.config.ble_adv_directed_interval = APP_ADV_DIRECTED_INTERVAL;
    init.config.ble_adv_directed_timeout = APP_ADV_DIRECTED_DURATION;
Children
No Data
Related