I have been working on a code using ble_app_blinky and try to insert whitelist on it using ble_app_hids_keyboard as reference. After the APP_ERROR_CHECK i get a NRF_BREAKPOINT_COND.
ret = pm_whitelist_set(m_whitelist_peers, m_whitelist_peer_cnt); APP_ERROR_CHECK(ret);
The app_error_fault_handler(uint32_t id, uint32_t pc, uint32_t info) indicates the id=0x00004001, pc=0x0000000 and info=0x2000ff14. Could anyone explain me what this means? Anywhere i could check what the different errors mean so i don´t have to bother you all the next time I have another issue with APP_ERROR_CHECK?
Thank you in advance.
SDK15, NRF52832, SES.
EDIT: I tried to add (inserted code) in the advertising_init function and i get exactly the same problem.
// Set advertising parameters.
memset(&adv_params, 0, sizeof(adv_params));
adv_params.primary_phy = BLE_GAP_PHY_1MBPS;
adv_params.duration = APP_ADV_DURATION;
adv_params.properties.type = BLE_GAP_ADV_TYPE_CONNECTABLE_SCANNABLE_UNDIRECTED;
adv_params.p_peer_addr = NULL;
adv_params.filter_policy = BLE_GAP_ADV_FP_ANY;
adv_params.interval = APP_ADV_INTERVAL;
err_code = sd_ble_gap_adv_set_configure(&m_adv_handle, &m_adv_data, &adv_params);
UPDATE:Doing some tests:
ret_code_t pm_whitelist_set(pm_peer_id_t const * p_peers,
return im_whitelist_set(p_peers, peer_cnt);
in my custom code the last line in that code is never executed and it goes directly to to APP_ERROR_CHECK
OKay, so its pm_whitelist_set that returns an error code that is not NRF_SUCCESS. Looking at the VERIFY_MODULE_INITIALIZED macro you'll see that it will return NRF_ERROR_INVALID_STATE if the module, i.e. Peer Manager is not initialized.
VERIFY_MODULE_INITIALIZED() VERIFY_TRUE((MODULE_INITIALIZED), NRF_ERROR_INVALID_STATE)
Have you called pm_init() which sets the m_module_initialized flag in pper_manager.c to true?
Thanks for the answer, i realized i never called the peer_manager_init function after reading your reply. I was trying to solve the problem checking on the sdk_config and checking if all the libraries needed were added.
About the sd_ble_gap_adv_set_configure(&m_adv_handle, &m_adv_data, &adv_params) APP_ERROR i guessed the problem was that i was using ble_advertising_init and i wanted to use sd_ble_gap_adv_set_configure to modify the adv_params. Any idea why the code crashes if both are used?
what error code does sd_ble_gap_adv_set_configure() return when you call it a second time( the first is in advertising_init()) to modify the advertisment parameters?
The error code i get is 0x00000004.
Error code 0x04 is NRF_ERROR_NO_MEM, which is returned when there is not enough memory to configure a new advertising handle. You need to update an existing advertising handle instead, see sd_ble_gap_adv_set_configure documention on Infocenter.
Oh, ok. I understand now how to know what the error is.
Thanks so much