- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
We're using HF Audio Gateway example on CYW920706WCDEVAL and ModusToolbox 2.3. Every time we accept ACL connection from remote device, the SDK issues a role switch - see BTSpy log extract below.
3962 17:35:02.583 D🠊 HCI CMD HCI_RAW Command Data:
3963 17:35:02.583 D🠊 HCI CMD 0000: b3 18 a8 0d ec 38 00 .....8.
3964 17:35:02.583 D🠊 HCI CMD SENT [2] Command to HCI. Name: HCI_Accept_Connection_Request (Hex Code: 0x0409 Param Len: 7)
3965 17:35:02.583 D🠊 HCI CMD BD_ADDR of remote device : 38-ec-0d-a8-18-b3
3966 17:35:02.583 D🠊 HCI CMD Role (0 = master, 1 = slave) : 0 (0x00)
How to disable that? We want that our evaluation board remains slave after accepting incoming connection.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please try the following code to see if it works:
wiced_result_t hci_control_management_callback( wiced_bt_management_evt_t event, wiced_bt_management_evt_data_t *p_event_data ) { .... switch( event ) { case BTM_ENABLED_EVT: .... { uint8_t role; role = wiced_bt_l2cap_set_desire_role(L2CAP_ROLE_DISALLOW_SWITCH); WICED_BT_TRACE("==== disable switch role=%d\n", role ); role = wiced_bt_l2cap_set_desire_role(HCI_ROLE_SLAVE); WICED_BT_TRACE("==== set desire role=%d\n", role ); } break; .... } }
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please try the following code to see if it works:
wiced_result_t hci_control_management_callback( wiced_bt_management_evt_t event, wiced_bt_management_evt_data_t *p_event_data ) { .... switch( event ) { case BTM_ENABLED_EVT: .... { uint8_t role; role = wiced_bt_l2cap_set_desire_role(L2CAP_ROLE_DISALLOW_SWITCH); WICED_BT_TRACE("==== disable switch role=%d\n", role ); role = wiced_bt_l2cap_set_desire_role(HCI_ROLE_SLAVE); WICED_BT_TRACE("==== set desire role=%d\n", role ); } break; .... } }
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Owen_Zhang123 Thank you for the answer! Just let me understand: the 1st API call wiced_bt_l2cap_set_desire_role(L2CAP_ROLE_DISALLOW_SWITCH) disables role switch and the 2nd call wiced_bt_l2cap_set_desire_role(HCI_ROLE_SLAVE) makes sure that our device will be a slave even if it initiates ACL connection, right? But what about incoming connections? Does the 1st API call wiced_bt_l2cap_set_desire_role(L2CAP_ROLE_DISALLOW_SWITCH) disables role switch for incoming connections as well?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, you can use the API wiced_bt_l2cap_set_desire_role(L2CAP_ROLE_DISALLOW_SWITCH) to disable the role switch.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content