Is there any multiple channel/connection SPP examples?

54 views
Skip to first unread message

Ho Tony

unread,
Oct 23, 2021, 4:17:03 PM10/23/21
to btstack-dev
We want to connect to the Raspberry Pi 3B+ spp_counter with 2 android Application through SPP/RFCOMM, and it seems that example is not working even if I have changed the follwoings:
```
#define RFCOMM_SERVER_CHANNEL 2
```
The original is set to 1.

Except above, I also add the followings into the port/raspi/btstack_config.h
```
// Test for 2 connection ssp
#define MAX_NR_HCI_CONNECTIONS 2
#define MAX_NR_L2CAP_SERVICES  4
#define MAX_NR_L2CAP_CHANNELS  4
#define MAX_NR_RFCOMM_MULTIPLEXERS 1
#define MAX_NR_RFCOMM_SERVICES 2
#define MAX_NR_RFCOMM_CHANNELS 4
```

After the modification, the first SPP connection from the android app A is OK, then the seconds connections would make the first one disconnected:

```
SDP service record size: 95
Local name: SP B8:27:EB:E7:8D:48
BTstack up and running at B8:27:EB:E7:8D:48

SSP User Confirmation Request with numeric value '646813'
SSP User Confirmation Auto accept
RFCOMM channel nr 2 id 1 requested for D8:CE:3A:A2:22:52
RFCOMM channel open succeeded. New RFCOMM Channel ID 1, max frame size 990
2021.10.23-15:56:18.90 - <info> RFCOM chanel 1 Can sent now

RFCOMM channel closed
SSP User Confirmation Request with numeric value '753597'
SSP User Confirmation Auto accept
RFCOMM channel nr 2 id 2 requested for D8:CE:3A:A2:22:52
RFCOMM channel open succeeded. New RFCOMM Channel ID 2, max frame size 990
2021.10.23-15:56:47.41 - <info> RFCOM chanel 2 Can sent now
```
I don't know what's the problem in the modification to use multiple SPP connection, any help would be thankful.

Matthias Ringwald

unread,
Oct 23, 2021, 4:28:58 PM10/23/21
to btsta...@googlegroups.com
Hi Tony

If you're using the Raspi port in port/raspi, you don't need to configure connections as it is using malloc by default.

No idea why the first RFCOMM connection gets closed when the second Android connects. My best guess is that the Bluetooth Controller does not like being a slave in two piconets.
Please also post the /tmp/hci_dump.pklg file for us to check what's the reason for the disconnect.

Best
Matthias
> --
> You received this message because you are subscribed to the Google Groups "btstack-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to btstack-dev...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/btstack-dev/b2a75707-242c-40e6-8bac-12d6361bc300n%40googlegroups.com.

Ho Tony

unread,
Oct 24, 2021, 10:15:30 PM10/24/21
to btstack-dev
Thanks Ringwald.
Following is the pklg file: hci_dump.pklg
As no attachement is the edit menu, so I upload it to a server.

Also, I use the following settings:

#define MAX_NR_BNEP_CHANNELS MAX_SPP_CONNECTIONS
#define MAX_NR_HCI_CONNECTIONS MAX_SPP_CONNECTIONS
#define MAX_NR_L2CAP_CHANNELS  (1+MAX_SPP_CONNECTIONS)
#define MAX_NR_RFCOMM_CHANNELS MAX_SPP_CONNECTIONS
#define MAX_NR_RFCOMM_MULTIPLEXERS MAX_SPP_CONNECTIONS
#define MAX_SPP_CONNECTIONS 2


Ho Tony

unread,
Oct 25, 2021, 2:47:09 AM10/25/21
to btstack-dev
Matthias,
  except the above log from RaspberryPi 3B+ in the previous reply, I also have made a testing with CSR8510 in linux PC, it has the same log with raspberry pi built-in BCM controller.
  This is the CSR8510+Linux PC hci log, hope this would be useful for you to help the debuuging.

Thanks.

Matthias Ringwald

unread,
Oct 25, 2021, 4:19:32 AM10/25/21
to btsta...@googlegroups.com
Hi Tony

Do you want to connect from two Android devices or from two applications running on on Android device?

Anyway, in the CSR8510 log, first Android device connects and opens an RFCOMM channel. Then, after about 30 seconds, it closes that channel again. About 5 seconds later, the Android device disconnects. So, as far as I can tell, the Android side is not doing what you're expecting.

If you want to connect from two Android apps, I can imagine that you need 2 SDP records with 2 SPP UUIDs. Then one app can connect to one service and the other to the second one.

Best
Matthias
> To view this discussion on the web visit https://groups.google.com/d/msgid/btstack-dev/2e7657aa-0725-4a11-b99c-81f9fa1e089dn%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages