基于单片机控制的蓝牙数据传输外文翻译资料

 2023-08-28 05:08

原文:

MCU-Controlling Based Bluetooth Data Transferring Jia LIU, Guangmin SUN*, Dequn ZHAO, Xu YAO, Yihang ZHANG

Abstract

Based on researching of Bluetooth Protocol, a kind of Bluetooth data transferring system based on MCU-controlling has been proposed in the paper. In the system, the MCU in which the Bluetooth HCI protocol has been embedded is used to control the Bluetooth module on UART and make the Bluetooth devices in the Bluetooth network establish connection and transfer data automatically. In the hardware design, the chip C8051F020 is selected as the host controller. Because chip C8051F020 has two UART serial interfaces, it can meet the requirement of design, simplify the circuit and enhance system anti-jamming capability. The Bluetooth module used in the system is CSR Bluetooth Core 4 with Bluetooth Standard 2.0 class 1 which has the advantages of high signal sensitivity, long distance of connection and easy to use..

Keywords: Bluetooth; Data Communication; MCU; HCI; UART

1. Introduction

Bluetooth is a radio technology, supporting communication of device in short distance, and making

wireless information transfer between numerous devices possible. The Bluetooth has been used in a series

of technologies, methods and theories for hardware and software designs. For example, wireless

communication and technologies in network, engineering and software dependability theory, protocol

testing technology, standard describing language, built-in RTOS, cross-platform development and

graphical user interfaces technology, interface technology for software and hardware, and CMOS chips

integration technology etc.[1]. Because of the small size and the low power, the application of Bluetooth technology is more than a computerrsquo;s peripheral device. It can be integrated inside of any digital device,especially for micro devices and portable devices, which do not require high quality on transfer speed.

In modern life, with fast development of digital technology, the wireless information transfer is

needed frequently between all kinds of digital devices and computers. Especially in industrial control and data collection, a secure wireless way to connect and exchange information between computer and MCU is particularly important. Based on the problem, a Bluetooth communication system based on MCUcontrolling is proposed in the paper. The system is controlled by MCU and can communicate with any other Bluetooth device in the range of Bluetooth network, such as cellar phone, PDA etc.

2. Overview of Bluetooth Protocol Stack

2.1. Protocol Standards and Specification of Bluetooth

Bluetooth uses a variety of protocols. Core protocols are defined by the trade organization Bluetooth

SIG (Special Interest Group). Additional protocols have been adopted from other standards bodies. In this section, an overview of the core protocols and those adopted protocols that are widely used will be fully discussed. Core protocols provide the standards and qualification for Bluetooth products.

Currently, the Bluetooth specification has several versions 1.0, 1.1, 2.0, 2.1, 3.0, 4.0[2]. On April 21,

2010, the Bluetooth SIG completed the Bluetooth Core Specification version 4.0, which includes Classic Bluetooth, Bluetooth high speed and Bluetooth low energy protocols. Bluetooth high speed is based on Wi-Fi, and Classic Bluetooth consists of legacy Bluetooth protocols[3].

Bluetooth is a standard wire-replacement communications protocol primarily designed for low power

consumption, with a short range (power-class-dependent: 100 m, 10 m and 1 m, but ranges vary in

practice; see table below) based on low-cost transceiver microchips in each device. Because the devices

use a radio (broadcast) communications system, they do not have to be in line of sight of each other.

TABLE I. PARAMETERS OF EACH CLASS

In most cases the effective range of class 2 devices is extended if they connect to a class 1 transceiver,

compared to a pure class 2 network. This is accomplished by the higher sensitivity and transmission

power of Class 1 devices. While the Bluetooth Core Specification does mandate minimums for range, the range of the technology is application specific and is not limited. Manufacturers may tune their

implementations to the range needed to support individual use cases.

The Bluetooth Specification includes two parts: Protocol Specification and Application Framework.

The Protocol Specification defines Bluetooth protocols on each layer and the Application Framework

indicates that how to use those protocols to manufacture applications.

The Protocol Stack can be divided into three parts from top to bottom: Transfer Protocol, Mediation

Agreement and Application Protocol. The Transfer Protocol, including LMP, L2CAP, HCI, are in charge of confirming the mutual position of Bluetooth devices, establishing the physical link and logical link and managing them. The Mediation Agreement provide support for high-level application protocol or programs which work on the Bluetooth logical link, and provide application layer with all kinds of interfaces (such as RFCOMM, SDP, IrDA, PPP, UDP, TSC and AT instruction set etc.).

2.2. Bluetooth Core Protocol

Bluetooth Core Protocol is divided into four parts as:

1) Baseband Protocol (BP)

Baseband layer, also known as baseband packet, is a physical layer protocol in the Bluetooth protocol

stack. The Baseband in the Bluetooth manages physical channels and links apart from other services like error correction, data whitening, hop selection and Bluetooth security. The Baseband layer lies on top of the Bluetooth radio layer in the Bluetooth stack. The baseband protocol is implemented as a Link

Controlle

剩余内容已隐藏,支付完成后下载完整资料


附录A 译文

基于单片机控制的蓝牙数据传输

摘要——在研究蓝牙协议的基础上,提出了一种基于单片机控制的蓝牙数据传输系统。在系统中,嵌入了蓝牙HCI协议的MCU用于控制UART上的蓝牙模块,并使蓝牙网络中的蓝牙设备自动建立连接并传输数据。在硬件设计中,选择芯片C8051F020作为主机控制器。由于芯片C8051F020具有两个UART串行接口,因此可以满足设计要求,可以简化电路并增强系统的抗干扰能力。系统中使用的蓝牙模块是具有蓝牙标准2.0等级1的CSR蓝牙核心4,具有信号灵敏度高,连接距离长且易于使用的优点。

关键字:蓝牙;数据通讯; MCU;人机交互串口

1.简介

蓝牙是一种无线电技术,支持短距离设备之间的通信,并使得可以在众多设备之间进行无线信息传输。蓝牙技术已被应用在硬件和软件设计。例如,无线网络,工程和软件可靠性理论,协议中的通信和技术测试技术,标准描述语言,内置RTOS,跨平台开发和图形用户界面技术,软件和硬件的界面技术以及CMOS芯片集成技术等[1]。由于体积小,功耗低,蓝牙不仅仅是计算机的外围设备。它可以集成在任何数字设备内部,特别是对于不需要高质量传输速度的微型设备和便携式设备。在现代生活中,随着数字技术的飞速发展,无线信息传输正在迅速发展。各种数字设备和计算机之间经常需要。特别是在工业控制和数据收集,一种在计算机和MCU之间连接和交换信息的安全无线方式特别重要。针对这一问题,提出了一种基于单片机控制的蓝牙通信系统。在本文中提出。该系统由MCU控制,可以与任何蓝牙网络范围内的其他蓝牙设备,例如地下电话,PDA等。

2.蓝牙协议栈概述

2.1蓝牙协议标准和规范

蓝牙使用多种协议。核心协议SIG由贸易组织蓝牙定义(特殊兴趣小组)。其他标准机构也采用了其他协议。在这部分,将全面介绍核心协议和广泛采用的那些协议。核心协议提供了蓝牙产品的标准和资格。

当前,蓝牙规范具有多个版本如1.0、1.1、2.0、2.1、3.0、4.0 [2]。 4月21日,2010年,蓝牙SIG完成了蓝牙核心规范版本4.0,其中包括经典版蓝牙,蓝牙高速和蓝牙低能耗协议。蓝牙高速基于Wi-Fi和经典蓝牙由传统的蓝牙协议组成[3]。

蓝牙是主要用于低功耗的标准有线替换通信协议,范围很短(取决于功率等级:100 m,10 m和1 m,具体范围;参 见下表),基于每个设备中的低成本收发器微芯片。因为设备使用无线电(广播)通信系统,它们不必彼此在视线范围内。

在大多数情况下,如果将2类设备连接到1类收发器,则它们的有效范围就会扩大,与纯第2类网络相比。通过更高的灵敏度和透射率来实现1类设备的功能。虽然蓝牙核心规范确实规定了最小范围,但该技术的范围是特定于应用的,并且不受限制。制造商可能会调整他们的产品实现以支持单个用例所需的范围。

蓝牙规范包括两部分:协议规范和应用框架。协议规范在每个层和应用程序框架上定义了蓝牙协议,指示如何使用这些协议来制造应用程序。

协议栈从上到下可以分为三部分:传输协议,中介协议和应用协议。传输协议(包括LMP,L2CAP,HCI)负责确认蓝牙设备的相互位置,建立物理链接和逻辑链接以及管理他们。调解协议为高级应用程序协议或程序可在蓝牙逻辑链路上工作,并为应用程序层提供各种接口(例如RFCOMM,SDP,IrDA,PPP,UDP,TSC和AT指令集等)。

2.2蓝牙核心协议

蓝牙核心协议分为四个部分:

2.2.1基带协议(BP)

基带层,也称为基带数据包,是蓝牙协议中的物理层协议堆。蓝牙中的基带管理物理信道和链接,与其他服务不同,例如纠错,数据白化,跃点选择和蓝牙安全性。基带层位于蓝牙堆栈中的蓝牙无线电层。基带协议一般为链接控制器,它与链接管理器一起执行链接级例程,例如链接连接和电源控制。基带还管理异步和同步链路,处理数据包和进行寻呼和查询以访问和查询该区域中的蓝牙设备。

2.2.2链路管理协议(LMP)

这用于在蓝牙设备之间建立链接,并用于控制无线电链接。它是在主机控制器上实现。

2.2.3逻辑链路控制和适配协议(L2CAP)

这是一种适配协议,它为高级传输层协议屏蔽了基带协议。它为高层应用程序层和传输层提供了更有效的数据包格式。它用于在使用不同高级协议的两个设备之间多路复用逻辑连接。它提供了广播数据包的分段和重组。

在基本模式下,L2CAP为数据包提供的有效载荷最高可配置为64kB,其中672个字节为默认的MTU,48字节是支持的最低强制性MTU。在重传和流控制模式下,可以将L2CAP配置为可靠或同步数据通过执行重传和CRC检查来确定每个通道。蓝牙核心规范附录1向核心添加了两个附加的L2CAP模式规范:增强型重传模式(ERTM)[4]和流模式(SM)[5]。这些模式有效弃用原始的重传和流控制模式。通过配置重传次数和刷新超时(无线电将刷新数据包的时间),下层蓝牙BDR / EDR空中接口可选地和/或额外地保证了这些模式中任何一种的可靠性,下层保证按顺序排序。

2.2.4服务发现协议(SDP)

SDP在蓝牙框架中起着非常重要的作用,它是所有用户模式的基础。它允许发现其他设备支持的服务及其相关参数的设备。例如,将手机连接到蓝牙耳机时,SDP将用于确定哪个耳机支持蓝牙配置文件(耳机配置文件,免提配置文件,高级音频)分发配置文件(A2DP)等,以及连接到每个协议所需的协议多路复用器设置。

每个服务均由通用唯一标识符(UUID)标识,并为官方服务(蓝牙配置文件)分配了简短的UUID(16位而不是完整的128位)。 在蓝牙系统中,只有通过SDP,设备端才能获取设备信息,服务信息和服务特征,从而建立不同的SDP层链路[6]。

2.3 HCI协议

HCI(主机控制器接口)标准化了主机堆栈(例如PC或移动电话OS)和控制器(蓝牙IC)之间的通信。 该标准允许以最小的适应性交换主机堆栈或控制器IC。HCI属于蓝牙协议栈,它是蓝牙规范定义的标准接口。 适合蓝牙通讯模块的硬HCI传输层是蓝牙主机和蓝牙主机控制器之间的物理接口,目前,HCI传输层的物理接口由通用串行总线(USB),串行端口(RS232),通用异步收发器(UART)和个人计算机内存组成 卡[7]。 最常用的是USB(在PC中)和UART(在手机和PDA中)。在UART传输层上,可以在同一PCB板上的两个UART串行端口之间使用Bluetooth HCI协议[8]。

系统使用UART在Bluetooth主机和Bluetooth主机控制器之间传输数据。 UART接收数据字节并以顺序方式传输各个位。 在目的地,第二个UART将这些位重新组装为完整的字节。 每个UART都包含一个移位寄存器,这是串行和并行形式之间转换的基本方法。 通过单线或其他介质进行的数字信息(位)串行传输比通过多线的并行传输具有更高的成本效益。

通常,UART不直接生成或接收在不同设备项之间使用的外部信号。 单独的接口设备用于将UART的逻辑电平信号与外部信号电平之间进行转换。 外部信号可能有许多不同的形式。 电压信令标准的示例是EIA提供的RS-232,RS-422和RS-485。 从历史上看,电报电路中使用有无电流(在电流回路中)。 一些信令方案不使用电线。 这样的示例是其串行端口配置文件(SPP)中的光纤,IrDA和蓝牙。

一些信令方案使用载波信号的调制(有或没有电线)。 例如,使用电话线调制解调器对音频信号进行调制,使用数据无线电进行RF调制以及用于电力线通信的DC-LIN。 该通信可以是“全双工”或“半双工”。

在系统中,UART使用RS232接口参数配置。

图2.1 接口参数配置

使用RTS / CTS是为了避免UART缓冲区溢出。 当CTS值为1时,它允许主机控制器或蓝牙主机传输数据,而当CTS值为0时,它不允许传输数据。完整的流时间是从将RTS的值设置为0到流传输完成的最长时间。[9] 。UART信号线将调制解调器模式设置为空,并且将RS232设置为连接状态。 本地TXD与远程RXD链接到RS232,反之亦然。 UART具有校正功能。 当蓝牙主机与主机控制器的连接断开时,必须将其重置。 RS232不同步意味着HCI数据包指示符或HCI数据包长度超出范围[10]。 如果主机控制器和蓝牙主机之间不同步,则主机控制器会将硬件停机的信息发送到蓝牙主机,并通知错误消息。 对于重新同步,主机控制器需要接受来自蓝牙主机的命令以进行重置。

系统设计:

图2.2系统硬件设计

在研究了蓝牙协议之后,我们通过使用蓝牙模块(蓝牙)与主机控制器(MCU)连接的模式进行系统设计。 在系统中,MCU将接受AT命令以控制UART上的蓝牙模块。

系统设计有几个技术目标,如下:

1)自动连接方式

对于这种连接方式,我们应该预先配对两个具有相同硬件结构但物理地址不同的Bluetooth-MCU设备。 如果两个设备达到连接距离,它们将自动连接。

2)闪存

MCU上装有FLASH芯片。 要发送的数据可以存储在闪存中,并且在两个设备之间建立链接时将自动发送。 数据将会发送不止一次。

3)搜索选择功能

主设备可以搜索与其具有相同型号的所有设备以及网络中具有蓝牙功能的其他设备。 搜索结果的格式为“设备地址 设备类型 信号强度”,主设备将在搜索后确定要链接的设备。

4)接收方式

该系统具有两种接收模式:一种是Bluetooth-MCU设备与PC等其他智能终端连接,而智能终端负责数据传输。另一个是没有终端与Bluetooth-MCU设备连接,数据将直接发送到FLASH。 该模式删除了终端部分,使设备更便携,并且设备可以随时与他人建立链接并自动传输数据,而无需通知任何其他人或触发任何密钥。该系统分为两部分,一个是具有蓝牙HCI协议的蓝牙模块,另一个是充当主机控制器并在其上装有FLASH存储芯片的MCU。

3.系统硬件结构

该系统由串口上的MCU控制,可以配置蓝牙模块的参数并自动传输数据。

图3.1 Bluetooth-MCU系统的硬件结构

3.1芯片选择

3.1.1MCU

系统主控制器选择C8051F020的芯片。 C8051F020是混合信号系统级MCU。 它与CIP-51内核兼容,还具有SPI接口和两个UART串行接口,可以满足设计要求,简化电路,增强系统抗干扰能力。与普通MCU相比,C8051F020具有扩展芯片少,结构简单,资源多,计算速度快,编程简单,易于升级的优点。 可以保证其可靠性和稳定性。

3.1.2蓝牙模块

蓝牙模块使用CSR Bluetooth Core4的Bluetooth芯片,具有Bluetooth Standard 2.0 class1。BluetoothCore4具有信号灵敏度高,连接距离长的优点。且易于使用。它可以使用AT命令查看和配置参数,满足在无线串口上传输数据的要求。

蓝牙模块支持所有蓝牙协议。它使用串行通信模式,可以在通用串行接口和蓝牙数据传输之间转换。具有多从机的结构最多可以同时与7个具有SPP的远程蓝牙主设备进行通信。它使用AT命令设置控制参数或发出控制命令,并支持各种波特率。还支持硬件流控制,最大连接波特率为1382400bps。模块的通信频段为蓝牙标准2.4GHz。蓝牙模块包括三个部分:基带控制器,蓝牙适配器和2.4GHz射频模块。由于蓝牙适配器,增加了功率放大器和外部天线,扩展了蓝牙通信范围,从而在理想的环境中最大连接距离可以达到1800M。

3.1.3闪存芯片

FLASH芯片使用Atmel生产的AT45DB161D-SU。其存储容量为16M,并提供电压范围为2.7V-3.6V,最大工作电流为15mA。

3.2连接主机控制器和蓝牙模块

MCU使用频率为22.1184MHz的晶体,蓝牙模块与MCU的连接波特率为38400bps。 MCU在系统中扮演着主机控制器的角色,并且它与蓝牙模块的连接应该在HCI上。 HCI包括两个部分,一个是与蓝牙模块连接的主机控制器,另一个是命令界面软件。

lt;a id='_Toc8

剩余内容已隐藏,支付完成后下载完整资料


资料编号:[607545],资料为PDF文档或Word文档,PDF文档可免费转换为Word

您需要先支付 30元 才能查看全部内容!立即支付

课题毕业论文、开题报告、任务书、外文翻译、程序设计、图纸设计等资料可联系客服协助查找。