Android Bluetooth Serial Port Baud Rate

Posted on  by 

Send and receive data without byte limit, support 115200 baud rate continuously send and receive data 3. IBeacon mode. Support (serial port, IO, APP) sleep wake up; Support 4 channel IO port control 5. Support high precision RTC clock. Support UART and IIC communication mode, default to UART communication 6. Check the COM port Baud Rate. Then check the baud rate that this COM port is set to. Press the Window Start button and search for “device manager” (click image for full size image) In the Device Manager open the COM ports and right click on the COM port Number assigned to your mobile and click on the “Port Settings” tab check or change the baud rate. DroidTerm: A serial port terminal emulator for Android. – In Usb serial connection, baud rate, data bits, stop bits, parity can be configurable before connection. Flow control is still not supported. 46 thoughts on “ DroidTerm: A serial port terminal emulator for Android ” Please support PL2303. More about RS232 Bluetooth BLE serial converter, iOS, Android, Bluetooth 4.1 BLE RS-232 adapter from Taiwan Server Suppliers and Manufacturers.

Active4 years, 9 months ago

This is very frustrating as I've been trying for weeks and not even a clue on the internet.

I am working on a project that reads/writes bluetooth serial data on different farming hardware.

most of these hardware are old and changing the baud rate of their SPP is not an option.

I'm using the android bluetooth chat as a basis to read/write, I've only changed the UUID to allow connection to the devices I have

I've managed to read from a tag reader at a bad rate of 19,200 beautifully, and formatted nicely

However, I'm stuck now with the scales which has a baud rate of 9,600 and shows funny characters in my app, not even close to the format that should come from the scales

This project was done previously on a old Windows Mobile and baud rates could be changed in their API

Is there a way to do this in Android or am I barking up the wrong tree?

dsolimano
7,6373 gold badges41 silver badges57 bronze badges
ZiGiZiGi
3994 gold badges8 silver badges19 bronze badges

2 Answers

Presumably some Bluetooth to serial converter is attached to the legacy devices? If so you should be able to program it once to always use a particular bit rate. Then there would be no need for the Bluetooth client to set the bit rate...

alanjmcfalanjmcf
3,3641 gold badge13 silver badges13 bronze badges

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.

Serial Communication Baud Rates

Android Bluetooth Serial Port 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.

SerialTimmmm

Serial Baud Rates Table

Timmmm
40.7k38 gold badges219 silver badges278 bronze badges

Com Port Baud Rate

Not the answer you're looking for? Browse other questions tagged androidbluetoothserial-portrfcomm or ask your own question.

Coments are closed