Android Bluetooth Serial/RFCOMM/SPP, How to Change the BAUD RATE?

Edit: Fixed some errors.

There’s no good information on the internet about this – and lots of it is wrong – don’t trust anyone!

In particular, these two things are not true:

  • RFCOMM and SPP (Serial Port Profile) are two names for the same thing. (They are however very closely related.)
  • There’s no need to set the baud rate of an RFCOMM / SPP connection.

Here is what I have found:

Bluetooth serial connections are made as described in the SPP using RFCOMM. RFCOMM is a connection that runs over L2CAP and allows sending serial data and control parameters in frames. It is heavily based on an ancient standard called TS 07.10. SPP is the bluetooth profile.

This framing also allows you to send out-of-band data for things like controlling serial signals (DTR, CTS, etc) and for setting the baud rate.

From the SPP specification:

DevA may inform DevB of RS232 port settings with the Remote Port Negotiation
Command, directly before DLC establishment. There is a requirement to do so if the API to the RFCOMM adaptation layer exposes those settings (e.g. baud rate, parity).

Sadly Android doesn’t expose this functionality at all. I suppose it may be possible to send the Remote Port Negotiation command ourselves but I’m pretty sure that would require reimplementing RFCOMM which requires access to L2CAP that we don’t have.

The Remote Port Negotiation command is detailed here page 31. Note “There are default values assigned on all parameters, if no negotiation is performed, the default value is chosen.”

Therefore it is impossible to set the baud rate as desired on Android. It will use the default baud rate that your bluetooth adapter uses (probably 9600).

Also note that Windows does support setting the baud rate of bluetooth adapters.

Leave a Comment