Procedure of Bluetooth Rfcomm


#1

I want to establish a Bluetooth connection (serial protocol / rfcomm) between a Bluetooth app on an Android phone and a DragonBoard 410C(Linux OS: Debian)…

I was successful on Raspberry Pi3 Model B by commanding the following procedure onto the terminal.


[System]
Raspberry Pi3 Model B / OS : Raspbian(Jessie8.0)
Samsung Galaxy7 edge / Android phone

[Android App]
Bluetooth SPP PRO (downloaded freeware)
 
[Procedure]
1)sudo /etc/init.d/bluetooth stop
2)sudo /usr/lib/bluetooth/bluetoothd -C &
3)sudo sdptool browse local
   Note: serial port was not existing at this particular step.
4)sudo sdptool add --channel=22 SP
   Note: Machine response “Serial Port service registered.”
5)sudo sdptool browse local
   Note: following responses indicated successful addition of the serial port.
 
   Service Name: Serial Port
   Service Description: COM Port
   Service Provider: BlueZ
   Service RecHandle: 0x10005
   Service Class ID List:
      “Serial Port” (0x1101)
   Protocol Descriptor List:
      “L2CAP” (0x0100)
      “RFCOMM” (0x0003)
      Channel: 22
   Language Base Attr List:
      code_ISO639: 0x656e
      encoding: 0x6a
      base_offset: 0x100
   Profile Descriptor List:
      “Serial Port” (0x1101)
      Version: 0x0100
 
6)sudo hciconfig hci0 up
7)sudo hciconfig hci0 piscan
8)sudo hciconfig
   Note: Address of the connected device was confirmed to be “UP RUNNING PSCAN ISCAN”
9)sudo rfcomm watch /dev/rfcomm0 22
10)sudo echo “xxxx” > /dev/rfcomm0
   Note: “xxxx” means any character string

Followings were confirmed
— successful pairing
—constant connection
—given character string sent from the Raspberry Pi via Rfcomm to the Android terminal and the receipt confirmed on the Android App,

I want to execute the same on the Dragon Boards410C (Linux OS: Debian). But it fails on the default setting as follows;


3)sudo sdptool browse local
   Note: following statement appears.
   Failed to connect to SDP server on FF:FF:FF:00:00:00:
   No such file or directory [1]+ Exit 1 sudo /usr/lib/bluetooth/bluetoothd -C

4)sudo sdptool add --channel=22 SP

   ote:
   When using Raspberry pie, addition of the serial port was indicated in text
   but DragonBoard does not state anything.
   Further steps are skipped as it is obvious to be a failure.


How can I use the serial connection via Bluetooth on Dragon Board410C? I presume it may require certain pre-setting. Kindly advise me the detail of the setting.


#2

Hello @gamagic,

You don’t say which version of Debian you are running on the Dragonboard. I had an issue with SPP recently with one of the Debian Stretch snapshots.

That thread and the resolution is here:

Are you seeing errors in the bluetooth logs?


#3

Good day.

I have been thankful to those who kindly answered to my previous question.Despite of your advice, I had been lazy to skip reply. Allow me to thank you very much for the help that you rendered.

After that, I was able to send and recive data via Bluetooth SPP in reference to the indicated information on your message.(on Debian 210 SnapShot/233)

But,I still have another problem with me.

What I did was to connect a PC(Windows) with DragonBoard by a USB cable to conduct serial communication in between.

Thereafter, I used an Android smartphone which was connected with the DragonBoard by Bluetooth to input the following command to PC Terminal(TeraTerm);


echo “******” > /dev/rfromm0

Then I confirmed that the character string data was transferred, as I noticed the same text appeared on the Android app.

On top, I was also able to receive data sent from Android app on PC Terminal(TeraTerm) via rfcomm0, with using a serial data receiving program on the PC terminal.

However, if I repeat the same procedure on a standard terminal of DragonBoard (XTerm was used), the following message appears;

/dev/rfcomm0: Device or resorce busy

and I cannot send and recieve the data.

What I guess is that this may be a different problem than Bluetooth SPP and I am afraid that it may be irrelevant to post a question to you here.

But if there is anyone who has some idea of possible solution on this case, could you be so kind to share it with me?

Thank you.


#4

Hello @gamagic,

Glad to hear you’ve made some progress.

I believe that the example I’ve given doesn’t use the virtual device of /dev/rfcomm*. The connection to the Bluetooth Serial Port is via the file descriptor passed to the NewConnection function.

The example app didn’t have the functionally you describle. You will need to create your own terminal that connects to the file descriptor.

Regards,
Barry