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

Only receiving a single BLE_GAP_EVT_ADV_REPORT

Hello,

I want to add central-role features to my peripheral firmware. I've already managed to get this work. The strange thing, I only get one BLE_GAP_EVT_ADV_REPORT. So the firmeware receives one advertisement and then it stops receiving.

The documentation says that it stops/pauses scanning when an ADV_REPORT is received and BLE_GAP_ADV_DATA_STATUS_INCOMPLETE_MORE_DATA is not set. But I'm not even in extended mode.

I'm using a nRF52832-DK and the SDK is 15.3.0 with Softdevice 6.1.1. Here is my code:

Init and start:

void scanning_init(nrf_ble_scan_t scan) 
{
    ret_code_t err_code;

    m_scan = scan;

    ble_gap_scan_params_t scan_params;
    memset(&scan_params, 0, sizeof(scan_params)); 
    scan_params.active    = 0; 
    scan_params.interval  = 160;
    scan_params.window    = 80;
    scan_params.timeout   = BLE_GAP_SCAN_TIMEOUT_UNLIMITED;
    scan_params.scan_phys = BLE_GAP_PHY_1MBPS;
    scan_params.extended  = 0;

    nrf_ble_scan_init_t init_scan; 
    memset(&init_scan, 0, sizeof(init_scan)); 
    
    init_scan.connect_if_match = false,
    init_scan.p_conn_param = NULL,
    init_scan.conn_cfg_tag = NULL,
    init_scan.p_scan_param = &scan_params,


    err_code = nrf_ble_scan_init(&m_scan, &init_scan, evt_hdler);
    APP_ERROR_CHECK(err_code);
}

void scanning_start() 
{
    ret_code_t err_code;
    err_code = nrf_ble_scan_start(&m_scan);
    APP_ERROR_CHECK(err_code);
}

void on_ble_central_evt(ble_evt_t const * p_ble_evt)
{
    ret_code_t err_code;
    // For readability
    ble_gap_evt_t const        * p_gap_evt   = &p_ble_evt->evt.gap_evt;
    ble_gap_addr_t const * const p_peer_addr = &p_gap_evt->params.adv_report.peer_addr;


    switch (p_ble_evt->header.evt_id)
    {
        ...

        case BLE_GAP_EVT_ADV_REPORT:
        {
            NRF_LOG_INFO("Advertisement received");
        }
        break; // BLE_GAP_ADV_REPORT

        ...

        default:
            // No implementation needed.
            break;
    }
}

I can see "Advertisement received" in the log, but only once.

Any ideas? Thanks for your help in advance!

Parents Reply Children
Related