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

Setting up whitelist in SDK V12.2.0

ble_app_template.zipI need to setup whitelist. To achieve that while calling ble_advertising_init I specified

ble_adv_whitelist_enabled = true

then, while handling BLE_ADV_EVT_WHITELIST_REQUEST I use:

uint32_t err_code;
		ble_gap_addr_t whitelist_addr = {1, BLE_GAP_ADDR_TYPE_RANDOM_STATIC, {0x25,0xD7,0x90,0x11,0x7A,0xC8}};
    const ble_gap_addr_t      *p_whitelist_addr[] = {&whitelist_addr};
		switch (ble_adv_evt)
    {
			case BLE_ADV_EVT_WHITELIST_REQUEST:
				err_code = sd_ble_gap_whitelist_set(p_whitelist_addr, 1);
				APP_ERROR_CHECK(err_code);
				err_code = ble_advertising_whitelist_reply(NULL, 1, NULL, 0);
				APP_ERROR_CHECK(err_code);
			break;			

I made sure that both err_codes above are 0 once those 2 functions return but all this results in no advertising, instead I am experiencing (in RTT Viewer) APP_ERROR:ERROR:Fatal. If I commented out content of the 'case' above - then my device is advertising.

Did I miss anything while setting up my whitelist?

I think I did everything as described in Software Development Kit > nRF5 SDK > nRF5 SDK v12.2.0 > Libraries > BLE libraries > Advertising Module > Whiltelist > Usage

which says:

If you are using the S13x SoftDevice v3.x, call sd_ble_gap_whitelist_set. Then, call ble_advertising_whitelist_reply (you only need to provide the counts)

in my case I am using S132 V3.1.0

Update I tried to grab error details but Keil (?) is experiencing encoding issues while trying to display the file name, I don't have such a problem with at least files I create myself and main.c image description

The project can be found in the attachment.

Parents
  • The breakpoint was set in app_error_save_and_stop which is called from within

    __WEAK void app_error_fault_handler(uint32_t id, uint32_t pc, uint32_t info)
    {
        NRF_LOG_ERROR("Fatal\r\n");
        NRF_LOG_FINAL_FLUSH();
        // On assert, the system can only recover with a reset.
    #ifndef DEBUG
        NVIC_SystemReset();
    #else
        app_error_save_and_stop(id, pc, info);
    #endif // DEBUG
    }
    

    Yes, I defined DEBUG and turned off optimization, in fact I did everything as was suggested in the 2nd answer by Vidar Berg in this post: devzone.nordicsemi.com/.../

Reply
  • The breakpoint was set in app_error_save_and_stop which is called from within

    __WEAK void app_error_fault_handler(uint32_t id, uint32_t pc, uint32_t info)
    {
        NRF_LOG_ERROR("Fatal\r\n");
        NRF_LOG_FINAL_FLUSH();
        // On assert, the system can only recover with a reset.
    #ifndef DEBUG
        NVIC_SystemReset();
    #else
        app_error_save_and_stop(id, pc, info);
    #endif // DEBUG
    }
    

    Yes, I defined DEBUG and turned off optimization, in fact I did everything as was suggested in the 2nd answer by Vidar Berg in this post: devzone.nordicsemi.com/.../

Children
No Data
Related