Bluetooth SPP using Linux

Markus Becker
Posts: 22
Joined: Fri Mar 02, 2018 3:24 pm

Bluetooth SPP using Linux

Postby Markus Becker » Wed Apr 25, 2018 7:53 pm

Dear all,

I try to connect to an ESP32 executing the bt_spp_acceptor demo from an Ubuntu 17.3 VM running on Virtualbox 5.1.30r, which fails.
The funny thing is, that I can connect to the ESP32 using Windows or Android.
And from the Linux Box connections to other SPP devices work too.

The procedure:
Pairing using bluetoothctl works, info shows the device correctly. (The problem persists regardless of bonding first or not)

Code: Select all

[bluetooth]# info 24:0A:C4:03:A3:CA
Device 24:0A:C4:03:A3:CA
	Name: ESP_SPP_ACCEPTOR
	Alias: ESP_SPP_ACCEPTOR
	Class: 0x2c0414
	Icon: audio-card
	Paired: yes
	Trusted: yes
	Blocked: no
	Connected: no
	LegacyPairing: no
	UUID: Serial Port               (00001101-0000-1000-8000-00805f9b34fb)
	RSSI: -49
Connecting the device using rfcomm then fails:

Code: Select all

esp32@esp32:~$ rfcomm connect /dev/rfcomm0 24:0A:C4:03:A3:CA
Can't connect RFCOMM socket: Connection refused
I made nice logs of the connection attempt, but am not brave enough to find the cause of the abort (If the issue is on ESP32 or Linux side):

Code: Select all

esp32@esp32:~$ sudo btmon --write ~/hcitrace.snoop | tee ~/hcitrace.txt
(Show starts at 32.789388)

I'll try to attach the log files here in the hope, someone more competent can give me a helping hand.

Best
Markus
Attachments
hcitrace.snoop.txt
binary trace file. Remove .txt extension
(5.61 KiB) Downloaded 1040 times
hcitrace.txt
(26.54 KiB) Downloaded 993 times

Markus Becker
Posts: 22
Joined: Fri Mar 02, 2018 3:24 pm

Re: Bluetooth SPP using Linux

Postby Markus Becker » Sat Apr 28, 2018 9:59 am

I digged further and finally found the following:

Code: Select all

esp32@esp32:~$ rfcomm connect 1 24:0A:C4:03:A3:CA 2
Connected /dev/rfcomm1 to 24:0A:C4:03:A3:CA on channel 2
Press CTRL-C for hangup
This means, by now we need to assign exactly channel 2 to get the connection up. Further, it seems impossible to establish a second (concurrent) connection.

I tend to think that this is a bug on the esp32 side, as channel (->dlci, Data Link Connection Identifier) should be allocated and assigned dynamic?
As soon as I have a clearer picture, I'll post a report on github.

Cheers,
Markus

PawelJalocha
Posts: 13
Joined: Tue Apr 24, 2018 9:14 pm

Re: Bluetooth SPP using Linux

Postby PawelJalocha » Sun Oct 28, 2018 5:32 pm

I have exactly same problem, did you possibly find a fix ?
Why does the BT SPP present itself as audio-card ?
This is the way tablets and laptops see it.

JoseIbanez
Posts: 1
Joined: Sat Jan 12, 2019 9:36 am

Re: Bluetooth SPP using Linux

Postby JoseIbanez » Sat Jan 12, 2019 9:45 am

Great post.

I see the same behaviour for Raspberry Pi to ESP32 bluetooth connection.
With channel 2 just works.

Please post any update in this forum.

Thanks
JI

Who is online

Users browsing this forum: Bing [Bot] and 60 guests