I am migrating from SDK v14.2.0 to v15.0.0 and from S132 to S112 (v6) using the NRF52810. I have mostly everything migrated, but a functionality that worked before does not seem to behave correctly now and have not been able to find the root cause.
I am using a whitelist, but if there are no peers, the device is started with:
and then after a user button press, the device will then switch to advertising without a whitelist:
m_advertising.adv_mode_current = BLE_ADV_MODE_FAST;
m_advertising.adv_modes_config.ble_adv_fast_timeout = APP_ADV_NOWHITELEST_TIMEOUT_IN_SECONDS;
err_code = ble_advertising_restart_without_whitelist(&m_advertising);
if (err_code != NRF_ERROR_INVALID_STATE)
but that results in an error code 7 (NRF_ERROR_INVALID_PARAM).If the device starts out in BLE_ADV_MODE_FAST, instead of BLE_ADV_MODE_IDLE, calling ble_advertising_restart_without_whitelist(), returns correctly.
That sounds strange.
Is is possible for you to upload your code? So that I can get a better overview of what is going on.
If your code contains any sensitive information and you don't want to upload your code to the public forum, it is possible to turn the case private first.
Best regards, Joakim.
I have duplicated the issue using the SDK v15.0.0 example: ble_app_template using IAR (using ble_app_template_pca10040e_S112 with a Rigado dev board similar to the pca10040). Attached is the modified main.c file.I changed it so that instead of going into a sleep mode, it tries to restart without advertising. This produces the same error. Maybe I'm doing something fundamentally wrong, but this seems to duplicate the similar behavior in my application code.
The only section that should be different than the original example is the sleep_mode_enter() function.
Joakim Jakobsen Was my reply helpful or any updates?
In ble_advertising_restart_without_whitelist(), sd_ble_gap_adv_set_configure() returns NRF_ERROR_INVALID_PARAM.
According to the doumentation, sd_ble_gap_adv_set_configure() returns NRF_ERROR_INVALID_PARAM if:
- 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.
Did you remember to disable the whitelist setting in m_advertising.adv_modes_config.ble_adv_whitelist_enabled?
Could you run the chip in debug mode and compare the settings of m_advertising for a non-working and a working case* ?
*working case: advertising without whitelist
Kristin thanks for the response.
It doesn't seem to be related to the whitelist, since I am able to restart without a whitelist if I am in BLE_ADV_MODE_FAST and then call ble_advertising_restart_without_whitelist().It seems to be related to going from BLE_ADV_MODE_IDLE to BLE_ADV_MODE_FAST mode.
If I comment out:
ret = flags_set(p_advertising, BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE);
in ble_advertising_restart_without_whitelist function, I no longer get the issue and it works correctly.
Full modified function:
uint32_t ble_advertising_restart_without_whitelist(ble_advertising_t * const p_advertising)
p_advertising->whitelist_temporarily_disabled = true;
p_advertising->whitelist_in_use = false;
p_advertising->adv_params.filter_policy = BLE_GAP_ADV_FP_ANY;
// Set correct flags.
//ret = flags_set(p_advertising, BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE);
ret = ble_advertising_start(p_advertising, p_advertising->adv_mode_current);
if ((ret != NRF_SUCCESS) && (p_advertising->error_handler != NULL))
It is unclear which config is causing the issue or how to resolve this error without modified the Nordic SDK source code, since ble_advertising_start() seems to set the rest of the parameters correctly.
Have you evaluated the main.c file above using the example I referenced?