0

Good day. The question is: There is an ARM device based on Cortex A9. There is a built-in Wi-Fi / Bluetooth module based on the RTL 8822bu chip, which is integrated into the device. The bluetooth driver for the chip is installed. Stack Blues 5.65 installed.

hciconfig -a
hci0:   Type: Primary  Bus: USB
BD Address: 00:05:44:33:22:11  ACL MTU: 1021:8  SCO MTU: 255:16
UP RUNNING PSCAN ISCAN
RX bytes:1531 acl:0 sco:0 events:76 errors:0
TX bytes:1775 acl:0 sco:0 commands:76 errors:0
Features: 0xff 0xfb 0xff 0xfe 0xdb 0xfd 0x7b 0x87
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
Link policy: RSWITCH HOLD SNIFF PARK
Link mode: PERIPHERAL ACCEPT
Name: 'Client'
Class: 0x000100
Service Classes: Unspecified
Device Class: Computer, Uncategorized
HCI Version: 4.1 (0x7)  Revision: 0xab5c
LMP Version: 4.1 (0x7)  Subversion: 0x313a
Manufacturer: Realtek Semiconductor Corporation (93)

There are two ESP32 based devices with configured spp (ESP_SPP_ROLE_SLAVE) on channel 1 and 2 respectively. Linux device has spp installed on ports 1 and 2.

**# sdptool add --channel=1 SP**
Serial Port service registered

**# sdptool add --channel=2 SP**
Serial Port service registered
 
**# rfcomm bind 0 CC:50:E3:8B:CA:5A 1  #ESP32-1
**# rfcomm bind 1 10:52:1C:BC:1D:36 2  #ESP32-2****

ESP32 devices are paired with a Linux device:

**# bluetoothctl**
Agent registered
Controller 00:05:44:33:22:11 Pairable: yes
[bluetooth\]# devices Paired
Device 10:52:1C:BC:1D:36 #ESP32-2
Device CC:50:E3:8B:CA:5A #ESP32-1
[bluetooth\]#

open rfcomm0 - there is a connection, data comes from the ESP32-1 device. All OK. I open the second device rfcomm1 (when rfcomm0 is open) - there is a connection, but data is not transmitted.

**# hcitool conn**
Connections:
\< ACL 10:52:1C:BC:1D:36 handle 5 state 7 lm CENTRAL AUTH ENCRYPT
\< ACL CC:50:E3:8B:CA:5A handle 4 state 1 lm CENTRAL AUTH ENCRYPT
**# 
**# rfcomm****
rfcomm0: CC:50:E3:8B:CA:5A channel 1 connected \[tty-attached\]
rfcomm1: 10:52:1C:BC:1D:36 channel 2 config \[tty-attached\]

log ESP32-1:

    (15380045) BT_HCI: hcif conn complete: hdl 0x81, st 0x0[0m
    (15380045) BT_BTM: BTM_InqDbRead: bd addr [000544332211]
    (15380085) BT_BTM: btm_sec_set_peer_sec_caps: sm4: 0x11, rmt_support_for_secure_connections 1
    (15380085) BT_BTM: btm_process_remote_ext_features: pend:0
    (15380095) BT_L2CAP: L2CA_SetDesireRole() new:x1, disallow_switch:0[0m
    (15380095) BT_BTM: btm_sec_set_peer_sec_caps: sm4: 0x11, rmt_support_for_secure_connections 1
    (15380105) BT_BTM: btm_process_remote_ext_features: pend:0
    (15380125) BT_L2CAP: L2CA_SetDesireRole() new:x1, disallow_switch:0[0m
    (15380295) BT_BTM: BTM_SetPowerMode: pm_id 128 BDA: 44332211 mode:0x0[0m
    (15380305) BT_L2CAP: L2CAP - Calling Connect_Ind_Cb(), CID: 0x0041[0m
    (15380305) BT_L2CAP: L2CA_ErtmConnectRsp()  CID: 0x0041  Result: 0  Status: 0  BDA: 000544332211            p_ertm_info:0x0[0m
    (15380315) BT_L2CAP: L2CA_ConfigReq()  CID 0x0041: fcr_present:0 (mode 0) mtu_present:1 (1691)[0m
    ++++++ BatteryShow() -> not in zuozi 
    (15380345) BT_L2CAP: L2CA_ConfigRsp()  CID: 0x0041  Result: 0 MTU present:0 Flush TO:0 FCR:1 FCS:0[0m
    (15380345) BT_L2CAP: L2CAP - Calling Config_Rsp_Cb(), CID: 0x0041[0m
    (15380375) BT_L2CAP: L2CA_DataWrite()  CID: 0x0041  Len: 4[0m
    (15380405) BT_L2CAP: L2CA_DataWrite()  CID: 0x0041  Len: 14[0m
    (15380455) BT_RFCOMM: PORT_CheckConnection() handle:1[0m
    (15380455) BT_RFCOMM: RFCOMM_CreateConnection()  BDA: ff-ff-ff-ff-ff-ff[0m
    (15380455) BT_RFCOMM: RFCOMM_CreateConnection(): scn:1, dlci:2, is_server:1 mtu:990, p_mcb:0x0[0m
    (15380465) BT_RFCOMM: RFCOMM_CreateConnection(): scn:1, dlci:2, is_server:1 mtu:990, p_mcb:0x0, p_port:0x3ffd0834[0m
    (15380475) BT_RFCOMM: PORT_SetEventCallback() handle:2[0m
    (15380485) BT_RFCOMM: PORT_SetEventMask() handle:2 mask:0x30005[0m
    (15380485) BT_RFCOMM: PORT_GetState() handle:2[0m
    (15380495) BT_RFCOMM: PORT_SetState() handle:2[0m
    (15380495) BT_RFCOMM: PORT_SetState() handle:2 FC_TYPE:0xc[0m
    (15380505) BT_L2CAP: L2CA_DataWrite()  CID: 0x0041  Len: 4[0m
    (15380515) BT_RFCOMM: PORT_CheckConnection() handle:1[0m
    (15380515) BT_L2CAP: L2CA_SetDesireRole() new:x1, disallow_switch:0[0m
    (15380525) BT_APPL: new conn_srvc id:26, app_id:255[0m
    (15380535) BT_L2CAP: L2CA_DataWrite()  CID: 0x0041  Len: 8[0m
    (15380535) BT_L2CAP: L2CA_DataWrite()  CID: 0x0041  Len: 8[0m
    (15380545) XXXXXXXXX: .....ESP_SPP_SRV_OPEN_EVT[0m
    (15380555) BT_BTM: BTM_SetPowerMode: pm_id 0 BDA: 44332211 mode:0x0[0m
    (15380555) BT_RFCOMM: PORT_WriteDataCO() handle:1[0m
    (15380565) BT_L2CAP: L2CA_DataWrite()  CID: 0x0041  Len: 906[0m
    (15380575) BT_BTM: BTM_SetPowerMode: pm_id 0 BDA: 44332211 mode:0x0[0m
    (15380575) BT_RFCOMM: PORT_WriteDataCO() handle:1[0m
    (15380585) BT_L2CAP: L2CA_DataWrite()  CID: 0x0041  Len: 905[0m
    (15380595) BT_BTM: BTM_SetPowerMode: pm_id 0 BDA: 44332211 mode:0x0[0m
    (15380595) BT_RFCOMM: PORT_WriteDataCO() handle:1[0m
    (15380605) BT_L2CAP: L2CA_DataWrite()  CID: 0x0041  Len: 247[0m
    (15380615) BT_BTM: BTM_SetPowerMode: pm_id 0 BDA: 44332211 mode:0x0[0m
    (15380615) BT_BTM: BTM_SetPowerMode: pm_id 0 BDA: 44332211 mode:0x0[0m
    (15380625) BT_BTM: BTM_SetPowerMode: pm_id 0 BDA: 44332211 mode:0x0[0m

log ESP32-2:

    (3068811) BT_HCI: hcif conn complete: hdl 0x80, st 0x0[0m
    (3068811) BT_BTM: BTM_InqDbRead: bd addr [000544332211]
    (3068881) BT_BTM: btm_sec_set_peer_sec_caps: sm4: 0x11, rmt_support_for_secure_connections 1
    (3068881) BT_BTM: btm_process_remote_ext_features: pend:0
    (3068891) BT_L2CAP: L2CA_SetDesireRole() new:x1, disallow_switch:0[0m
    (3068911) BT_BTM: btm_sec_set_peer_sec_caps: sm4: 0x11, rmt_support_for_secure_connections 1
    (3068911) BT_BTM: btm_process_remote_ext_features: pend:0
    (3068921) BT_L2CAP: L2CA_SetDesireRole() new:x1, disallow_switch:0[0m
    (3128811) BT_HCI: hci cmd send: disconnect: hdl 0x80, rsn:0x13[0m
    (3128921) BT_HCI: hcif disc complete: hdl 0x80, rsn 0x16[0m
    (3128921) BT_L2CAP: L2CA_SetDesireRole() new:x1, disallow_switch:0[0m
    (3129371) BT_HCI: hcif conn complete: hdl 0x81, st 0x0[0m
    (3129371) BT_BTM: BTM_InqDbRead: bd addr [000544332211]
    (3129451) BT_BTM: btm_sec_set_peer_sec_caps: sm4: 0x11, rmt_support_for_secure_connections 1
    (3129451) BT_BTM: btm_process_remote_ext_features: pend:0
    (3129461) BT_BTM: btm_sec_set_peer_sec_caps: sm4: 0x11, rmt_support_for_secure_connections 1
    (3129461) BT_BTM: btm_process_remote_ext_features: pend:0
    (3129471) BT_L2CAP: L2CA_SetDesireRole() new:x1, disallow_switch:0[0m
    (3129481) BT_L2CAP: L2CA_SetDesireRole() new:x1, disallow_switch:0[0m

As soon as I close the rfcomm0 connection, after a few seconds data from the ESP32-2 begins to arrive on the rfcomm1 port. And vice versa. Those. two ports do not want to work at the same time. Question: Maybe I have not configured something in the Linux system? I need to receive data from both ESP32 at the same time. Can you suggest a solution or at least in which direction to look?

P.S. I took a simple bluetooth dongle. I inserted a machine into Win, raised a virtual machine with Linux. Entered the same settings. Data is received from both ESP32 at the same time. I did not find any information regarding the RTL8822bu chip on the number of simultaneous bluetooth connections.

Evgeniy
  • 1
  • 2

0 Answers0