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

How to correctly set channel map of next connection?

I'm using s130_nrf51_2.0.0-4.alpha as central and do some testing with channel map. I set the channel map before I'm trying to connect to a peripheral with:

  ble_opt_t opt;
  memset(&opt, 0, sizeof(opt));
  opt.gap_opt.ch_map.ch_map[0] = 0xFF;
  opt.gap_opt.ch_map.ch_map[1] = 0x0F;
  err_code = sd_ble_opt_set(BLE_GAP_OPT_CH_MAP, &opt);
  APP_ERROR_CHECK(err_code);

  // Initiate connection.
  err_code = sd_ble_gap_connect(peer_addr,
                                &m_scan_param,
                                &conn_params);

But when I check the current active channel map during the connection, I get the default channel map!

  ble_opt_t opt;
  memset(&opt, 0, sizeof(opt));
  opt.gap_opt.ch_map.conn_handle = m_conn_handle_central;
  sd_ble_opt_get(BLE_GAP_OPT_CH_MAP, &opt);
  APP_LOG("ChMap %02X %02X %02X %02X %02X\r\n",
    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]);

Output:

ChMap FF FF FF FF 1F

Parents Reply
  • I tested it before calling sd_ble_gap_connect(...) as in your question and it worked. I checked in the connection parameter update request event (5 seconds after connection) . For the time it takes to change the map, this is from the bluetooth spec: "If this command is used, updates should be sent within 10 seconds, of the Host knowing that the channel classification has changed. The interval between two successive commands sent shall be at least 1 second."

Children
No Data
Related