匿名
未登录
登录
百问网嵌入式Linux wiki
搜索
查看“Bluetooth overview、”的源代码
来自百问网嵌入式Linux wiki
名字空间
页面
讨论
更多
更多
页面选项
Read
查看源代码
历史
←
Bluetooth overview、
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
This article explains how a Bluetooth framework is composed, how to configure it, and how to use it. == Framework purpose == '''Bluetooth''' is a protocol for wireless communication over short distances. It was developed in the 1990s to reduce the need for cable interconnects. Devices such as mobile phones, laptops, PCs, printers, digital cameras and video game consoles can connect to each other and exchange information using radio waves. This can be done securely. Bluetooth is only used for relatively short distances, typically of a few meters.<br /> The Linux kernel has a popular Bluetooth stack: BlueZ. This stack is included in most Linux kernels, and runs in both the user space and kernel space of the Bluetooth protocol. <br /> Bluetooth Low Energy is completely supported at the kernel level in Linux. Bluetooth can be used in many different use cases, as mentioned in the [[#How to use Bluetooth|How to use Bluetooth]] section: * how to set up a Bluetooth connection [[How to set up a Bluetooth connection|Setup Bluetooth]] * how to scan Bluetooth devices [[How to scan Bluetooth devices|Scan Bluetooth devices]] * how to scan BLE devices [[How to scan BLE devices|Scan BLE devices]] ==System overview== [[File:Bt_overview.png|thumb|center|766px|link=|alt=Alternate text|Bluetooth Overview]] ===Component descriptions=== ''From User space to hardware'' *'''Bluetooth Applications''' (User space) Lots of applications use bluetooth:<br /> bluetoothd <ref>[https://linux.die.net/man/8/bluetoothd], bluetoothd</ref>: bluetoothd daemon, which manages all the Bluetooth devices<br /> ... *'''BlueZ Utils''' (User space) Development and debugging utilities for the bluetooth protocol stack<br /> There is a set of utilities to manage Bluetooth devices:<br /> bluetoothctl <ref>[https://linux.die.net/man/8/hciconfig], bluetoothctl</ref>: Pairing a device from the shell is one of the simplest and most reliable options<br /> To see all other utilities: https://www.archlinux.org/packages/extra/x86_64/bluez-utils/ *'''BlueZ''' (Kernel space) BlueZ <ref>[http://www.bluez.org/about/], BlueZ</ref> is the official Linux Bluetooth stack. It provides, in a modular way, support for the core Bluetooth layers and protocols.<br /> Currently BlueZ consists of many separate modules:<br /> - bluetooth kernel subsystem core<br /> - a "controller stack" containing the timing critical radio interface like HCI <ref>[https://en.wikipedia.org/wiki/List_of_Bluetooth_protocols#HCI], HCI</ref><br /> - a "host stack" dealing with high level data like L2CAP <ref>[https://en.wikipedia.org/wiki/List_of_Bluetooth_protocols#Logical_link_control_and_adaptation_protocol_(L2CAP)], L2CAP</ref><br /> *'''Bluetooth companion driver''' (Kernel space) Bluetooth companion driver registers and controls the Bluetooth device *'''Serial/TTY''' (Kernel space) See [[Serial TTY overview]] *'''SoC: USART''' (Hardware) See [[Serial TTY overview]] ===APIs description=== The BlueZ API <ref>[https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc], BlueZ API</ref> is documented in the Linux Kernel:<br /> BlueZ exposes a socket API that is similar to network socket programming; the is socket created, used to communicate, PF_BLUETOOTH protocol family <ref>[https://en.wikipedia.org/wiki/Berkeley_sockets#Protocol_and_address_families], Socket</ref> ==Configuration == ===Kernel configuration=== Bluetooth must be enabled in the kernel configuration, as shown below. On top of this, the user has to activate STM32 support and [[Serial TTY overview#Kernel Configuration |STM32 USART support]]. The user can use the Linux Menuconfig tool: [[Menuconfig or how to configure kernel | Menuconfig or how to configure kernel ]] and select: <pre> [*] Networking support ---> [*] Bluetooth subsystem support [*] Bluetooth Classic (BR/EDR) features [*] Bluetooth High Speed (HS) features [*] Bluetooth Low Energy (LE) features [*] Bluetooth device drivers ---> [*] HCI UART driver [*] Device Drivers ---> [*] Character devices ---> [*] Serial device bus [*] Security options ---> [*] Enable access key retention support </pre> For example if the companion chip is the Murata product 1DX<ref>[http://wireless.murata.com/datasheet?/RFM/data/lbee5kl1dx.pdf], 1DX</ref> <pre> [*] Networking support ---> [*] Bluetooth subsystem support ---> [*] Bluetooth device drivers ---> [*] Broadcom protocol support </pre> ===Device tree=== DT bindings documentation deals with all of the required and optional [[Device tree|device tree]] properties. Detailed DT configuration for STM32 internal peripherals: [[Bluetooth device tree configuration|Bluetooth device tree configuration]]. ==How to use Bluetooth == === How to use the Bluetooth user space interface === Please see the examples based on the following use cases: * how to set up a Bluetooth connection [[How to set up a Bluetooth connection|Setup Bluetooth]] * how to scan Bluetooth devices [[How to scan Bluetooth devices|Scan Bluetooth devices]] * how to scan BLE devices [[How to scan BLE devices|Scan BLE devices]] ==How to trace and debug the framework== This part is an example based on the Murata companion chip ==== How to verify than Bluetooth driver is correctly probed ==== * In dmesg log, check "usart" logs : <pre> [ 0.485894] STM32 USART driver initialized [ 0.487163] 4000e000.serial: ttySTM1 at MMIO 0x4000e000 (irq = 21, base_baud = 4000000) is a stm32-usart [ 0.487514] stm32-usart 4000e000.serial: interrupt mode used for rx (no dma) [ 0.487531] stm32-usart 4000e000.serial: interrupt mode used for tx (no dma) </pre> And, if the companion chip is the Murata 1DX : <pre> [ 13.755069] Bluetooth: HCI device and connection manager initialized [ 13.800349] Bluetooth: HCI socket layer initialized [ 13.837861] Bluetooth: L2CAP socket layer initialized [ 13.843218] Bluetooth: SCO socket layer initialized [ 14.279668] Bluetooth: HCI UART driver ver 2.3 [ 14.282780] Bluetooth: HCI UART protocol H4 registered [ 14.288198] Bluetooth: HCI UART protocol Broadcom registered [ 14.289402] hci_uart_bcm serial0-0: No reset resource, using default baud rate [ 14.465008] Bluetooth: hci0: BCM: chip id 94 [ 14.469843] Bluetooth: hci0: BCM: features 0x2e [ 14.497113] Bluetooth: hci0: BCM43430A1 [ 14.499593] Bluetooth: hci0: BCM43430A1 (001.002.009) build 0000 </pre> ==References== <references /> <noinclude> [[Category:Bluetooth]] {{PublicationRequestId | 10174 | 2019-01-03 | PhilipS}} {{ArticleBasedOnModel | Framework overview article model}} </noinclude>
该页面使用的模板:
模板:ArticleBasedOnModel
(
查看源代码
)
模板:PublicationRequestId
(
查看源代码
)
返回至
Bluetooth overview、
。
导航
导航
WIKI首页
官方店铺
资料下载
交流社区
所有页面
所有产品
MPU-Linux开发板
MCU-单片机开发板
Linux开发系列视频
单片机开发系列视频
所有模块配件
Wiki工具
Wiki工具
特殊页面
页面工具
页面工具
用户页面工具
更多
链入页面
相关更改
页面信息
页面日志