Connection to Bluetooth Classic (SPP) does no longer work
Posted: Wed Feb 09, 2022 9:10 pm
Using Arduino-ESP32 in version >= 2.x.x a connection to a Bluetooth device using Bluetooth Serial is no longer working.
There already exists an github issue for this: https://github.com/espressif/arduino-esp32/issues/6061
There is no usefule debug output, so I tried to figure out the cause by also trying the IDF example.
I used the IDF directly and uploaded the "Iniator" example @ https://github.com/espressif/esp-idf/tr ... _initiator
This is also unable to connect. It seems it can't find the device by name, so I changed it to directly connect to the address.
It seems the SPP-Discovery is successful, but then it is not possible to establish serial connection:
Are there any know issues with some bluetooth chipsets? (Unfortunately I don't know the chipset of the peer, but I guess its same or similar to HC-05 or HC-06 modules?)
Debug output - See line 136 for failure to establish serial connection.
Is it correct what happens before? It does not ask for a PIN, however, the device was already paired before (using Arduino ESP32 1.xx)
[/code]
There already exists an github issue for this: https://github.com/espressif/arduino-esp32/issues/6061
There is no usefule debug output, so I tried to figure out the cause by also trying the IDF example.
I used the IDF directly and uploaded the "Iniator" example @ https://github.com/espressif/esp-idf/tr ... _initiator
This is also unable to connect. It seems it can't find the device by name, so I changed it to directly connect to the address.
It seems the SPP-Discovery is successful, but then it is not possible to establish serial connection:
Are there any know issues with some bluetooth chipsets? (Unfortunately I don't know the chipset of the peer, but I guess its same or similar to HC-05 or HC-06 modules?)
Debug output - See line 136 for failure to establish serial connection.
Is it correct what happens before? It does not ask for a PIN, however, the device was already paired before (using Arduino ESP32 1.xx)
- 32mI (3217) BT_BTM: BTM_InqDbRead: bd addr [201301180226]
- D (3227) BT_BTM: btm_acl_paging discing:0, paging:0 BDA: 201301180226
- 0m
- D (3227) BT_BTM: connecting_bda: 000000000000
- D (3237) BT_BTM: btm_find_or_alloc_dev
- D (3237) BT_BTM: btm_acl_update_busy_level
- m
- D (3247) BT_BTM: BTM_BLI_PAGE_EVT
- 0;32mI (3247) SPP_INITIATOR_DEMO: ESP_BT_GAP_DISC_STATE_CHANGED_EVT0m
- D (5797) BT_BTM: btm_acl_resubmit_page
- [0m
- D (5797) BT_BTM: btm_acl_created hci_handle=129 link_role=1 transport=1
- [0m
- D (5797) BT_BTM: btm_read_remote_features() handle: 129
- D (5797) BT_BTM: btm_handle_to_acl_index: 129
- [0m
- D (5807) BT_BTM: is_originator:0
- D (5807) BT_BTM: btm_sec_execute_procedure: Required:0x0 Flags:0x4090 State:0
- [0m
- D (5817) BT_BTM: Security Manager: Start get name
- [0m
- D (5817) BT_BTM: btm_acl_paging discing:0, paging:0 BDA: 201301180226
- D (5827) BT_BTM: btm_acl_update_busy_level
- [0m
- D (5827) BT_BTM: BTM_BLI_PAGE_DONE_EVT
- [0m
- D (5837) BT_BTM: btm_acl_created hci_handle=129 link_role=0 transport=1
- 0m
- D (5847) BT_BTM: Duplicate btm_acl_created: RemBdAddr: 201301180226
- D (5847) BT_BTM: BTM_SetLinkPolicy
- [0m
- D (5857) BT_BTM: BTM_SetLinkSuperTout
- [0m
- D (5857) BT_BTM: btm_sec_l2cap_access_req() is_originator:1, 0x3ffbb9d8
- m
- D (5867) BT_BTM: btm_find_or_alloc_dev
- m
- D (5867) BT_BTM: btm_sec_is_serv_level0: PSM: 0x0001 -> mode 4 level 0 service
- D (5877) BT_BTM: btm_read_remote_version_complete
- D (5877) BT_BTM: btm_handle_to_acl_index: 129
- m
- D (5887) BT_BTM: btm_read_remote_features_complete
- 0m
- D (5887) BT_BTM: btm_handle_to_acl_index: 129
- D (5897) BT_BTM: Start reading remote extended features
- [0m
- D (5897) BT_BTM: btm_read_remote_ext_features() handle: 129 page: 1
- D (5907) BT_BTM: btm_process_clk_off_comp_evt
- [0m
- D (5907) BT_BTM: btm_handle_to_acl_index: 129
- I (5917) BT_BTM: BTM_InqDbRead: bd addr [201301180226]
- D (5927) BT_BTM: BDA 20:13:01:18:02:26
- D (5927) BT_BTM: Inquire BDA 00:00:00:00:00:00
- D (5927) BT_BTM: btm_sec_rmt_name_request_complete
- D (5937) BT_BTM: setting BTM_SEC_NAME_KNOWN sec_flags:0x4098
- D (5937) BT_BTM: btm_sec_execute_procedure: Required:0x0 Flags:0x4098 State:0
- D (5947) BT_BTM: Security Manager: trusted:0x00000000
- [0m
- D (5957) BT_BTM: Security Manager: access granted
- 0m
- D (5997) BT_BTM: btm_get_max_packet_size
- [0m
- [0;32mI (6067) BT_BTM: BTM_SetPowerMode: pm_id 128 BDA: 01180226 mode:0x0[0m
- D (6067) BT_BTM: BTM_SetPowerMode: mode:0x0 interval 0 max:0, min:0
- [0;32mI (6097) SPP_INITIATOR_DEMO: ESP_SPP_DISCOVERY_COMP_EVT scn_num:1
- ;32mI (6097) SPP_INITIATOR_DEMO: -- [0] scn:1 service_name:Dev B
- I (6097) BT_BTM: btm_sec_set_security_level : sec: 0x12
- I (6107) BT_BTM: BTM_SEC_REG[2]: id 52, is_orig 1, psm 0x0003, proto_id 3, chan_id 1
- ;32mI (6117) BT_BTM: : sec: 0x2090, service name [] (up to 21 chars saved)
- [0m
- D (6127) BT_RFCOMM: port_find_mcb: not found, bd_addr:20:13:01:18:02:26
- I (6127) BT_RFCOMM: RFCOMM_CreateConnection() BDA: 20-13-01-18-02-26m
- I (6137) BT_RFCOMM: RFCOMM_CreateConnection(): scn:1, dlci:2, is_server:0 mtu:990, p_mcb:0x00m
- D (6147) BT_RFCOMM: rfc_cb.port.port[1]:0x3ffc33d8 allocated, last_port:1
- D (6157) BT_RFCOMM: port_allocate_port:bd_addr:20:13:01:18:02:26m
- I (6157) BT_RFCOMM: RFCOMM_CreateConnection(): scn:1, dlci:2, is_server:0 mtu:990, p_mcb:0x0, p_port:0x3ffc33d8
- D (6167) BT_RFCOMM: RFCOMM_CreateConnection dlci:2 signal state:0xb0m
- D (6177) BT_RFCOMM: port_open_continue, p_port:0x3ffc33d8
- D (6187) BT_RFCOMM: rfc_alloc_multiplexer_channel: bd_addr:20:13:01:18:02:26
- D (6187) BT_RFCOMM: rfc_alloc_multiplexer_channel:is_initiator:1
- D (6197) BT_RFCOMM: rfc_alloc_multiplexer_channel rfc_cb.port.rfc_mcb[0].state:0[0m
- D (6207) BT_RFCOMM: (rfc_cb.port.rfc_mcb[i].bd_addr:00:00:00:00:00:00
- D (6207) BT_RFCOMM: rfc_alloc_multiplexer_channel rfc_cb.port.rfc_mcb[1].state:0[0m
- D (6217) BT_RFCOMM: (rfc_cb.port.rfc_mcb[i].bd_addr:00:00:00:00:00:00
- D (6227) BT_RFCOMM: rfc_alloc_multiplexer_channel rfc_cb.port.rfc_mcb[2].state:0[0m
- D (6227) BT_RFCOMM: (rfc_cb.port.rfc_mcb[i].bd_addr:00:00:00:00:00:00
- D (6237) BT_RFCOMM: rfc_alloc_multiplexer_channel rfc_cb.port.rfc_mcb[3].state:0[0m
- D (6247) BT_RFCOMM: (rfc_cb.port.rfc_mcb[i].bd_addr:00:00:00:00:00:00
- D (6247) BT_RFCOMM: rfc_timer_free[0m
- D (6257) BT_RFCOMM: rfc_alloc_multiplexer_channel:is_initiator:1, create new p_mcb:0x3ffc3854, index:0
- D (6267) BT_RFCOMM: rfc_timer_start - timeout:60[0m
- D (6267) BT_RFCOMM: port_select_mtu application selected 990
- D (6277) BT_RFCOMM: port_select_mtu credit_rx_max 10, credit_rx_low 4, rx_buf_critical 15[0m
- D (6287) BT_RFCOMM: rfc_mx_sm_state_idle - evt:6
- I (6287) BT_BTM: BTM_SetPowerMode: pm_id 128 BDA: 01180226 mode:0x0
- D (6297) BT_BTM: BTM_SetPowerMode: mode:0x0 interval 0 max:0, min:0[0m
- D (6297) BT_BTM: btm_sec_l2cap_access_req() is_originator:1, 0x3ffbb9d8
- m
- D (6307) BT_BTM: btm_find_or_alloc_dev
- m
- D (6317) BT_BTM: btm_sec_l2cap_access_req: security_required 0x2090, is_originator 0x01, psm 0x0003
- 31mE (6317) BT_BTM: btm_sec_l2cap_access_req: (initiator) remote features unknown!!sec_flags:0x4098
- m
- I (6327) BT_RFCOMM: PORT_SetEventCallback() handle:2
- [0;32mI (6337) BT_RFCOMM: PORT_SetEventMask() handle:2 mask:0x300050m
- I (6347) BT_RFCOMM: PORT_GetState() handle:2m
- I (6347) BT_RFCOMM: PORT_SetState() handle:2m
- I (6357) BT_RFCOMM: PORT_SetState() handle:2 FC_TYPE:0xcm
- I (6357) SPP_INITIATOR_DEMO: ESP_SPP_CL_INIT_EVT handle:129 sec_id:520m
- D (36277) BT_RFCOMM: rfc_mx_sm_state_wait_conn_cnf - evt:14
- D (36277) BT_RFCOMM: PORT_CloseInd
- D (36277) BT_RFCOMM: port_rfc_closed state:1 sending events:0
- 0;32mI (36277) BT_RFCOMM: PORT_CheckConnection() handle:2[0m
- mW (36287) BT_RFCOMM: port_rfc_closed RFCOMM connection in state 1 closed: Peer connection failed (res: 16)
- D (36297) BT_RFCOMM: port_release_port, p_port:0x3ffc33d8m
- D (36307) BT_RFCOMM: rfc_port_closed DONE[0m
- D (36307) BT_RFCOMM: rfc_timer_start - timeout:2
- D (36307) BT_RFCOMM: rfc_port_timer_stop
- D (36317) BT_RFCOMM: port_release_port:p_port->keep_port_handle:0m
- D (36317) BT_RFCOMM: port_release_port:Clean-up handle:2
- D (36327) BT_RFCOMM: rfc_port_timer_stop
- D (36327) BT_RFCOMM: rfc_timer_free
- D (36337) BT_BTM: btm_acl_removed
- D (36337) BT_BTM: btm_acl_report_role_change
- m
- D (36347) BT_BTM: btm_acl_resubmit_page
- 0m
- D (36347) BT_BTM: btm_sec_disconnected before update sec_flags=0x4098
- D (36357) BT_BTM: btm_sec_disconnected after update sec_flags=0x98
- [0m
- I (36357) SPP_INITIATOR_DEMO: ESP_SPP_CLOSE_EVT status:0 handle:129 close_by_remote:1
- [0;31mE (36367) BT_BTC: btc_spp_cb_handler unable to find RFCOMM slot!