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

nrf52840 BLE Channel Map

Hi All

I am right now working with nRf52840DK on Segger Embedded Studio (S140 SoftDevice), and I am trying to read my BLE channel map by function 

sd_ble_opt_get()
, but I did not get the expected result.

Basically, my code is like this:

int main(void)
{
    bool erase_bonds;

    // Initialize.
    log_init();
    timer_init();
    power_management_init();
    buttons_leds_init(&erase_bonds);
    ble_stack_init();
    gatt_init();
    peer_manager_init();
    db_discovery_init();
    hrs_c_init();
    bas_c_init();
    scan_init();

    ble_opt_t opt;
    memset(&opt,0,sizeof(opt));

    // Start execution.
    NRF_LOG_INFO("Heart Rate collector example started.");
    scanning_start(&erase_bonds);

    // Enter main loop.
    for (;;)
    {
        idle_state_handle();
        uint32_t error_code = sd_ble_opt_get(BLE_GAP_OPT_CH_MAP, &opt);
        printf("error_code =%x, ChMap %02X %02X %02X %02X %02X\r\n",error_code,
    		opt.gap_opt.ch_map.ch_map[0], opt.gap_opt.ch_map.ch_map[1],
                     opt.gap_opt.ch_map.ch_map[2],
    		opt.gap_opt.ch_map.ch_map[3], opt.gap_opt.ch_map.ch_map[4]);
//        nrf_delay_ms(500);
    }
}

The printf output from the code is:

error_code =3002, ChMap 00 00 00 00 00

If anyone knows why I got all "0" as my channel map reading output? And how could I make it right?

Parents Reply Children
Related