Android蓝牙串口RFCOMM低波特率/慢传输 [英] Android Bluetooth Serial RFCOMM low baud rate / slow transmission

查看:11
本文介绍了Android蓝牙串口RFCOMM低波特率/慢传输的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从事一个 Android 蓝牙 项目,用于从定制硬件发送和接收数据.我在 SDK 中使用 Bluetooth Chat Sample 作为基础.

I'm working on an Android Bluetooth project to send and receive data from a custom made hardware. I used Bluetooth Chat Sample in SDK as basis.

我意识到无法在客户端(Android 手机)上更改波特率,并且波特率将取决于硬件.我尝试在硬件上设置不同的波特率,但没有一个达到我们的预期;

I realized that there is no way to change baud rate on Client (Android phone) and baud rate will depend on hardware. I tried setting different baud rates on hardware and none met our expectations;

我能得到的最快速度是 91Kbps(当波特率设置为 2.7Mbps ~ 910Kbps).使用最小波特率 (115Kbps) 我得到 43Kbps.我尝试使用不同的手机,结果都是一样的.我需要每秒向硬件传输 170KB 数据.

Fastest i can get is 91Kbps (when baud rate is set to 2.7Mbps ~ 910Kbps). Using minimum baud rate (115Kbps) i get 43Kbps. I tried using different phones and it's the same. I need to transfer 170KB data per second to hardware.

规格
协议:使用最大 520 字节大小的包将同步或生成的数据发送到硬件.硬件在收到并批准每个数据包后发送验证命令,然后手机发送下一个数据包.
客户端:Android 2.3.3、Samsung Galaxy w i8150、Bluetooth v3.0、RFCOMM
硬件:自定义,蓝牙 v2.1 BlueGiga WT11i

Specifications
Protocol: Synchronized or generated data is sent to hardware using packages of maximum 520 bytes size. Hardware sends verify command after each package recieved and approved then phone sends next data package.
Client: Android 2.3.3, Samsung galaxy w i8150, Bluetooth v3.0, RFCOMM
Hardware: Custom, Bluetooth v2.1 BlueGiga WT11i

我很困惑..这可能是手机上的Android或蓝牙设备引起的问题吗?我想知道最大波特率是多少?有没有办法加快传输速度(比如增加最大包大小,或发送所有包而不等待硬件验证命令).

I'm totally confused.. Can it possibly be a problem caused by Android or Bluetooth device on the phone? I wonder what the maximum baud rate is? Is there a way to speed up the transmission (like increasing maximum package size, or sending all packages without waiting for hardware verify commands).

编辑
将包大小改为 4160 Bytes 后,Throughput 有增加到 254Kbps.我正在尝试找出最佳包装大小达到 1.5Mbps.我感谢任何建议

Edit
After changing the package size to 4160 Bytes, Throughput has increased to 254Kbps. I'm trying to figure out the optimum package size to reach 1.5Mbps. I appreciate any suggestions

推荐答案

首先在蓝牙RFCOMM/串口协议上改变波特率应该没什么区别,因为它不是真正的串口,而只是一个仿真.(特定的制造商可以用它做一些特别的事情,但一般蓝牙或 Android 不使用该参数来控制空中比特率)

Firstly changing the baud rate on the Bluetooth RFCOMM / Serial Port protocol should not make a difference, since it is not a real serial port but just an emulation. (Specific manufacturers could so something special with it but Bluetooth in general or Android does not use the parameter to control over the air bit rates)

影响SPP数据速率的因素将是数据包的大小实际你可以克服的最大数据速率蓝牙以及接收器读取的速度/发送器发送的频率.对于数据包大小,您可以查看内部文档或尝试不同的大小以达到适合您的应用程序的最佳数量.另外我建议发送多个数据包(或全部),直到流可以连续发送数据,类似地连续读取.

The factors that effect the data rate over SPP will be the size of the packets, the practical max data rate you can get over Bluetooth and how fast the receiver is reading / and how frequently the sender is sending. For the packet size you could look at internal documentations or try different sizes to reach an optimal number for your application. Also I would suggest sending multiple packets (or all) until the stream can send data continuously, similarly read continuously.

这里的主要问题似乎是您可以通过蓝牙实现的实用吞吐量.如果您在问题中提到使用非 EDR 版本,那么极低级别的理论速度为 720Kbps ,并且还增加了协议和应用程序开销作为 RFCOMM 协议开销,您可以获得最大大约 450-500 Kbps.

The main issue here for you seems to be the practical throuput you can achieve over Bluetooth. If you are using the non-EDR versions as you have mentioned in your question the theoretical speed at the very low level is 720Kbps , and adding protocol and application over heads as well as RFCOMM protocol overhead you could get max around 450-500 Kbps.

如果您可以访问 +EDR 即蓝牙 2.0 或更高版本 + EDR 的两个设备,那么您可以预期应用 吞吐量 的数量级为 1.2 到 1.5 Mbps(理论上的空中比特率为 2.0 或 3.0 Mbps)

If you have access to both devices that are +EDR I.e Bluetooth version 2.0 or more + EDR then you can expect application throuput in the order of 1.2 to 1.5 Mbps ( theoretical over the air bit rate being 2.0 or 3.0 Mbps)

这篇关于Android蓝牙串口RFCOMM低波特率/慢传输的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆