Difficulty configuring CODE PHY S8 and S2

When I need to switch between 1M and 2M

I create an object of the type bt_conn_le_phy_param and fill in the parameters appropriate to the radio mode I want, and then I call the method bt_conn_le_phy_update(), and it works well.

For example:

const struct bt_conn_le_phy_param preferred_phy = {
	.options = BT_CONN_LE_PHY_OPT_NONE,
	.pref_rx_phy = BT_GAP_LE_PHY_1M,
	.pref_tx_phy = BT_GAP_LE_PHY_1M,
};
err = bt_conn_le_phy_update(conn, &preferred_phy);
if (err) {
	LOG_ERR("bt_conn_le_phy_update() returned %d", err);
}

or

const struct bt_conn_le_phy_param preferred_phy = {
	.options = BT_CONN_LE_PHY_OPT_NONE,
	.pref_rx_phy = BT_GAP_LE_PHY_2M,
	.pref_tx_phy = BT_GAP_LE_PHY_2M,
};
err = bt_conn_le_phy_update(conn, &preferred_phy);
if (err) {
	LOG_ERR("bt_conn_le_phy_update() returned %d", err);
}

but when I try to use this same approach for CODE PHY

const struct bt_conn_le_phy_param preferred_phy = {
	.options = BT_CONN_LE_PHY_OPT_CODED_S8,
	.pref_rx_phy = BT_GAP_LE_PHY_CODED,
	.pref_tx_phy = BT_GAP_LE_PHY_CODED,
};
err = bt_conn_le_phy_update(conn, &preferred_phy);
if (err) {
	LOG_ERR("bt_conn_le_phy_update() returned %d", err);
}

the method return

bt_conn_le_phy_update() returned -5

I enabled the logs for the bt_hci_core and bt_conn files and the logs returned are these

[00:00:24.004,699] <dbg> bt_hci_core: bt_hci_cmd_create: opcode 0x2032 param_len 7
[00:00:24.004,852] <dbg> bt_hci_core: bt_hci_cmd_create: buf 0x2000d4c8
[00:00:24.004,882] <dbg> bt_hci_core: bt_hci_cmd_send_sync: buf 0x2000d4c8 opcode 0x2032 len 10
[00:00:24.005,065] <dbg> bt_hci_core: process_events: count 3
[00:00:24.005,096] <dbg> bt_hci_core: process_events: ev->state 4
[00:00:24.005,096] <dbg> bt_hci_core: send_cmd: calling net_buf_get
[00:00:24.005,310] <dbg> bt_hci_core: send_cmd: calling sem_take_wait
[00:00:24.005,340] <dbg> bt_hci_core: send_cmd: Sending command 0x2032 (buf 0x2000d4c8) to driver
[00:00:24.005,340] <dbg> bt_hci_core: bt_send: buf 0x2000d4c8 len 10 type 0
[00:00:24.005,615] <dbg> bt_hci_core: process_events: ev->state 0
[00:00:24.005,615] <dbg> bt_hci_core: process_events: ev->state 0
[00:00:24.005,889] <dbg> bt_hci_core: bt_recv: buf 0x2000d4c8 len 6
[00:00:24.005,920] <dbg> bt_hci_core: hci_cmd_status: opcode 0x2032
[00:00:24.005,920] <dbg> bt_hci_core: hci_cmd_done: opcode 0x2032 status 0x11 buf 0x2000d4c8
[00:00:24.006,530] <dbg> bt_conn: bt_conn_prepare_events: 
[00:00:24.006,530] <dbg> bt_conn: conn_prepare_events: Adding conn 0x20004fb8 to poll list
[00:00:24.006,805] <dbg> bt_conn: conn_prepare_events: wait on host fifo
[00:00:24.006,805] <dbg> bt_hci_core: hci_tx_thread: Calling k_poll with 3 events
[00:00:24.007,110] <wrn> bt_hci_core: opcode 0x2032 status 0x11

In the prj.conf file I added the configuration

CONFIG_BT_USER_PHY_UPDATE=y

and in main file I put 

#define BT_CONN_LE_PHY_PARAM_ALL

in an attempt to help resolve it, but I was unsuccessful

I'm out of ideas, 

Could someone help me make it work? Thanks

 

Parents Reply Children
Related