Some questions about bluetooth

Hi! nordic,

I am using nRF52840 and NCS v2.5.0.

I have some questions about bluetooth.

1.about channel map

when I simply read the channel map through a function, it looks like this:

function:

result:

It seems correct, but the order is different from the Bluetooth manual.

Then, I use the function  bt_le_set_chan_map()

to set the channel map, but the channel map read out doesn't match the one I set. I can't figure it out.

2.How to update PHY in connection?For example, if I want to change the TX PHY during the transmission process from tx_phy = 1 (1M) to 2M or coded S8, what should I do? Are there any relevant examples?

3.Is there an example of extended advertising?

Parents Reply Children
  • Hi!Amanda H,
    this is read_channel_map():
    code:
    static void read_channel_map(uint16_t handle, struct bt_hci_rp_le_read_chan_map *map_data)
    {
        struct net_buf *buf, *rsp = NULL;
        struct bt_hci_cp_le_read_chan_map *cp;
        struct bt_hci_rp_le_read_chan_map *rp;

        int err;

        buf = bt_hci_cmd_create(BT_HCI_OP_LE_READ_CHAN_MAP, sizeof(*cp));
        if (!buf) {
            printk("Unable to allocate command buffer\n");
            return;
        }

        cp = net_buf_add(buf, sizeof(*cp));
        cp->handle = sys_cpu_to_le16(handle);

        err = bt_hci_cmd_send_sync(BT_HCI_OP_LE_READ_CHAN_MAP, buf, &rsp);

        rp = (void *)rsp->data;
        *map_data = *rp;
        net_buf_unref(rsp);
    }
    I wrote based on the get_tx_power function in the hci_pwr_ctrl project.
  • Hi, 

    The bt_le_set_chan_map() function is used for central devices to set a channel map in a connection. Could you test the code with the central sample under zephyr\samples\bluetooth and connect with the peripheral sample under zephyr\samples\bluetooth? You also could take a look at this post

    -Amanda H.

Related