Connection to Bluetooth Classic (SPP) does no longer work

euphi77
Posts: 1
Joined: Wed Feb 09, 2022 8:55 pm

Connection to Bluetooth Classic (SPP) does no longer work

Postby euphi77 » 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)
  1. 32mI (3217) BT_BTM: BTM_InqDbRead: bd addr [201301180226]
  2.  
  3. D (3227) BT_BTM: btm_acl_paging discing:0, paging:0 BDA: 201301180226
  4. 0m
  5. D (3227) BT_BTM: connecting_bda: 000000000000
  6.  
  7. D (3237) BT_BTM: btm_find_or_alloc_dev
  8.  
  9. D (3237) BT_BTM: btm_acl_update_busy_level
  10. m
  11. D (3247) BT_BTM: BTM_BLI_PAGE_EVT
  12.  
  13. 0;32mI (3247) SPP_INITIATOR_DEMO: ESP_BT_GAP_DISC_STATE_CHANGED_EVT0m
  14. D (5797) BT_BTM: btm_acl_resubmit_page
  15. [0m
  16. D (5797) BT_BTM: btm_acl_created hci_handle=129 link_role=1  transport=1
  17. [0m
  18. D (5797) BT_BTM: btm_read_remote_features() handle: 129
  19.  
  20. D (5797) BT_BTM: btm_handle_to_acl_index: 129
  21. [0m
  22. D (5807) BT_BTM: is_originator:0
  23.  
  24. D (5807) BT_BTM: btm_sec_execute_procedure: Required:0x0 Flags:0x4090 State:0
  25. [0m
  26. D (5817) BT_BTM: Security Manager: Start get name
  27. [0m
  28. D (5817) BT_BTM: btm_acl_paging discing:0, paging:0 BDA: 201301180226
  29.  
  30. D (5827) BT_BTM: btm_acl_update_busy_level
  31. [0m
  32. D (5827) BT_BTM: BTM_BLI_PAGE_DONE_EVT
  33. [0m
  34. D (5837) BT_BTM: btm_acl_created hci_handle=129 link_role=0  transport=1
  35. 0m
  36. D (5847) BT_BTM: Duplicate btm_acl_created: RemBdAddr: 201301180226
  37.  
  38. D (5847) BT_BTM: BTM_SetLinkPolicy
  39. [0m
  40. D (5857) BT_BTM: BTM_SetLinkSuperTout
  41. [0m
  42. D (5857) BT_BTM: btm_sec_l2cap_access_req() is_originator:1, 0x3ffbb9d8
  43. m
  44. D (5867) BT_BTM: btm_find_or_alloc_dev
  45. m
  46. D (5867) BT_BTM: btm_sec_is_serv_level0: PSM: 0x0001 -> mode 4 level 0 service
  47.  
  48. D (5877) BT_BTM: btm_read_remote_version_complete
  49.  
  50. D (5877) BT_BTM: btm_handle_to_acl_index: 129
  51. m
  52. D (5887) BT_BTM: btm_read_remote_features_complete
  53. 0m
  54. D (5887) BT_BTM: btm_handle_to_acl_index: 129
  55.  
  56. D (5897) BT_BTM: Start reading remote extended features
  57. [0m
  58. D (5897) BT_BTM: btm_read_remote_ext_features() handle: 129 page: 1
  59.  
  60. D (5907) BT_BTM: btm_process_clk_off_comp_evt
  61. [0m
  62. D (5907) BT_BTM: btm_handle_to_acl_index: 129
  63.  
  64. I (5917) BT_BTM: BTM_InqDbRead: bd addr [201301180226]
  65.  
  66. D (5927) BT_BTM: BDA 20:13:01:18:02:26
  67.  
  68. D (5927) BT_BTM: Inquire BDA 00:00:00:00:00:00
  69.  
  70. D (5927) BT_BTM: btm_sec_rmt_name_request_complete
  71.  
  72. D (5937) BT_BTM: setting BTM_SEC_NAME_KNOWN sec_flags:0x4098
  73.  
  74. D (5937) BT_BTM: btm_sec_execute_procedure: Required:0x0 Flags:0x4098 State:0
  75.  
  76. D (5947) BT_BTM: Security Manager: trusted:0x00000000
  77. [0m
  78. D (5957) BT_BTM: Security Manager: access granted
  79. 0m
  80. D (5997) BT_BTM: btm_get_max_packet_size
  81. [0m
  82. [0;32mI (6067) BT_BTM: BTM_SetPowerMode: pm_id 128 BDA: 01180226 mode:0x0[0m
  83. D (6067) BT_BTM: BTM_SetPowerMode: mode:0x0 interval 0 max:0, min:0
  84. [0;32mI (6097) SPP_INITIATOR_DEMO: ESP_SPP_DISCOVERY_COMP_EVT scn_num:1
  85. ;32mI (6097) SPP_INITIATOR_DEMO: -- [0] scn:1 service_name:Dev B
  86. I (6097) BT_BTM: btm_sec_set_security_level : sec: 0x12
  87.  
  88. I (6107) BT_BTM: BTM_SEC_REG[2]: id 52, is_orig 1, psm 0x0003, proto_id 3, chan_id 1
  89.  
  90. ;32mI (6117) BT_BTM:                : sec: 0x2090, service name [] (up to 21 chars saved)
  91. [0m
  92. D (6127) BT_RFCOMM: port_find_mcb: not found, bd_addr:20:13:01:18:02:26
  93. I (6127) BT_RFCOMM: RFCOMM_CreateConnection()  BDA: 20-13-01-18-02-26m
  94. I (6137) BT_RFCOMM: RFCOMM_CreateConnection(): scn:1, dlci:2, is_server:0 mtu:990, p_mcb:0x00m
  95. D (6147) BT_RFCOMM: rfc_cb.port.port[1]:0x3ffc33d8 allocated, last_port:1
  96. D (6157) BT_RFCOMM: port_allocate_port:bd_addr:20:13:01:18:02:26m
  97. I (6157) BT_RFCOMM: RFCOMM_CreateConnection(): scn:1, dlci:2, is_server:0 mtu:990, p_mcb:0x0, p_port:0x3ffc33d8
  98. D (6167) BT_RFCOMM: RFCOMM_CreateConnection dlci:2 signal state:0xb0m
  99. D (6177) BT_RFCOMM: port_open_continue, p_port:0x3ffc33d8
  100. D (6187) BT_RFCOMM: rfc_alloc_multiplexer_channel: bd_addr:20:13:01:18:02:26
  101. D (6187) BT_RFCOMM: rfc_alloc_multiplexer_channel:is_initiator:1
  102. D (6197) BT_RFCOMM: rfc_alloc_multiplexer_channel rfc_cb.port.rfc_mcb[0].state:0[0m
  103. D (6207) BT_RFCOMM: (rfc_cb.port.rfc_mcb[i].bd_addr:00:00:00:00:00:00
  104. D (6207) BT_RFCOMM: rfc_alloc_multiplexer_channel rfc_cb.port.rfc_mcb[1].state:0[0m
  105. D (6217) BT_RFCOMM: (rfc_cb.port.rfc_mcb[i].bd_addr:00:00:00:00:00:00
  106. D (6227) BT_RFCOMM: rfc_alloc_multiplexer_channel rfc_cb.port.rfc_mcb[2].state:0[0m
  107. D (6227) BT_RFCOMM: (rfc_cb.port.rfc_mcb[i].bd_addr:00:00:00:00:00:00
  108. D (6237) BT_RFCOMM: rfc_alloc_multiplexer_channel rfc_cb.port.rfc_mcb[3].state:0[0m
  109. D (6247) BT_RFCOMM: (rfc_cb.port.rfc_mcb[i].bd_addr:00:00:00:00:00:00
  110. D (6247) BT_RFCOMM: rfc_timer_free[0m
  111. D (6257) BT_RFCOMM: rfc_alloc_multiplexer_channel:is_initiator:1, create new p_mcb:0x3ffc3854, index:0
  112. D (6267) BT_RFCOMM: rfc_timer_start - timeout:60[0m
  113. D (6267) BT_RFCOMM: port_select_mtu application selected 990
  114. D (6277) BT_RFCOMM: port_select_mtu credit_rx_max 10, credit_rx_low 4, rx_buf_critical 15[0m
  115. D (6287) BT_RFCOMM: rfc_mx_sm_state_idle - evt:6
  116. I (6287) BT_BTM: BTM_SetPowerMode: pm_id 128 BDA: 01180226 mode:0x0
  117. D (6297) BT_BTM: BTM_SetPowerMode: mode:0x0 interval 0 max:0, min:0[0m
  118. D (6297) BT_BTM: btm_sec_l2cap_access_req() is_originator:1, 0x3ffbb9d8
  119. m
  120. D (6307) BT_BTM: btm_find_or_alloc_dev
  121. m
  122. D (6317) BT_BTM: btm_sec_l2cap_access_req: security_required 0x2090, is_originator 0x01, psm  0x0003
  123.  
  124. 31mE (6317) BT_BTM: btm_sec_l2cap_access_req: (initiator) remote features unknown!!sec_flags:0x4098
  125. m
  126. I (6327) BT_RFCOMM: PORT_SetEventCallback() handle:2
  127. [0;32mI (6337) BT_RFCOMM: PORT_SetEventMask() handle:2 mask:0x300050m
  128. I (6347) BT_RFCOMM: PORT_GetState() handle:2m
  129. I (6347) BT_RFCOMM: PORT_SetState() handle:2m
  130. I (6357) BT_RFCOMM: PORT_SetState() handle:2 FC_TYPE:0xcm
  131. I (6357) SPP_INITIATOR_DEMO: ESP_SPP_CL_INIT_EVT handle:129 sec_id:520m
  132. D (36277) BT_RFCOMM: rfc_mx_sm_state_wait_conn_cnf - evt:14
  133. D (36277) BT_RFCOMM: PORT_CloseInd
  134. D (36277) BT_RFCOMM: port_rfc_closed state:1 sending events:0
  135. 0;32mI (36277) BT_RFCOMM: PORT_CheckConnection() handle:2[0m
  136. mW (36287) BT_RFCOMM: port_rfc_closed RFCOMM connection in state 1 closed: Peer connection failed (res: 16)
  137. D (36297) BT_RFCOMM: port_release_port, p_port:0x3ffc33d8m
  138. D (36307) BT_RFCOMM: rfc_port_closed DONE[0m
  139. D (36307) BT_RFCOMM: rfc_timer_start - timeout:2
  140. D (36307) BT_RFCOMM: rfc_port_timer_stop
  141. D (36317) BT_RFCOMM: port_release_port:p_port->keep_port_handle:0m
  142. D (36317) BT_RFCOMM: port_release_port:Clean-up handle:2
  143. D (36327) BT_RFCOMM: rfc_port_timer_stop
  144. D (36327) BT_RFCOMM: rfc_timer_free
  145. D (36337) BT_BTM: btm_acl_removed
  146.  
  147. D (36337) BT_BTM: btm_acl_report_role_change
  148. m
  149. D (36347) BT_BTM: btm_acl_resubmit_page
  150. 0m
  151. D (36347) BT_BTM: btm_sec_disconnected before update sec_flags=0x4098
  152.  
  153. D (36357) BT_BTM: btm_sec_disconnected after update sec_flags=0x98
  154. [0m
  155. I (36357) SPP_INITIATOR_DEMO: ESP_SPP_CLOSE_EVT status:0 handle:129 close_by_remote:1
  156. [0;31mE (36367) BT_BTC: btc_spp_cb_handler unable to find RFCOMM slot!
[/code]

Who is online

Users browsing this forum: No registered users and 87 guests