Hi everyone!
Could anyone clarify a few questions regarding channel mapping?
1. Is that true if I want to use specific BLE channels I need to do it just once on a central device?
2. Is that true once channel map is set it will be used for all next connections until it's changed again?
3. Is that true it's not necessary to set channel map only when connection event happens? I can do it, say, when I initialize central device, because connection handler is only applicable for sd_ble_opt_get().
4. Is that true default values of channel map 0xff,0xff,0xff,0xff,0x1f mean that adaptive frequency hopping is used?
5. Is that true if I set, say, following map 0x00,0xff,0xff,0xff,0x1f this means channels from 0 to 7 will be used for connection and others except dvertising channels will be ignored by frequency hopping algorithm?
6. When does a central device provide information about channel map to a peripheral device? My understanding is it happens on connection? How to make sure reliably this was happened? When I read channel map upon connection by using sd_ble_opt_get() I always get default values 0xff,0xff,0xff,0xff,0x1f.
7. Finally, here is the code I use to set channel map on a central device side (I run it just one time):
ble_gap_opt_ch_map_t channel_map = {0}; channel_map.conn_handle = m_conn_handle; //I tried to use connection //handle when I get it upon connection //also I left the field unflled. //No difference, err_code is always 0. channel_map.ch_map[0] = 0x00; channel_map.ch_map[1] = 0xfe; channel_map.ch_map[2] = 0xff; channel_map.ch_map[3] = 0xff; channel_map.ch_map[4] = 0x1f; err_code = sd_ble_opt_set(BLE_GAP_OPT_CH_MAP, (ble_opt_t *)&channel_map); //always returns 0
And here is the code I use to read channel map on peripheral device side (I run it every time when connection happened):
ble_opt_t opt; memset(&opt, 0, sizeof(opt)); opt.gap_opt.ch_map.conn_handle = m_conn_handle; err_code = sd_ble_opt_get(BLE_GAP_OPT_CH_MAP, &opt); //returns 0 LOG( "err_code = %x, map %x,%x,%x,%x,%x", err_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]);
My expectation is once I set channel map on central device I see (in a few second) same channel map on peripheral device side.
Since my connections are pretty short 300-900 ms, I thought I would see updated channel map after a few connection later, but it never happens. What did I miss?
Thanks,
Dmitry.