蓝牙协议栈 Bluetooth stack (English)
这是一个包含传统蓝牙跟低功耗蓝牙的协议栈,属于超轻量级蓝牙协议栈,用作学习蓝牙协议栈的人使用
CSR8311 | CYW54591 | BCM43430A (AP6212A) |
BCM4345C5 (AP6256) |
|
---|---|---|---|---|
STM32F103 | √ | × | × | × |
STM32F407 | √ | × | × | × |
STM32F412 | √ | × | × | × |
Linux | √ | √ | √ | √ |
购买连接: | 购买开发板连接(点击我) | 暂未上线 | 暂未上线 | 暂未上线 |
目录文件夹 | 子目录文件夹 | 说明 |
---|---|---|
board | stm32f10x | STM32F103板载外设驱动 |
stm32f407 | STM32F407板载外设驱动 | |
stm32f412 | STM32F412板载外设驱动 | |
bsp | cortex-m3 | Cortex M3 Driver库(M3默认用标准库) |
cortex-m4 | Cortex M4 Driver库(M3默认用HAL库) | |
component | bluetooth | 蓝牙协议栈源码 |
cjson | json源码(目前用于跟上位机交互) | |
fs | file system文件系统,目前用于管理spi flash | |
memory_manager | 内存管理,目前用于管理STM32F407的SRAM | |
ringbuffer | 环形数组,用于蓝牙接收串口数据 | |
mcu_bt_tool | PC上位机,用于控制STM32开发板,以及接受STM32的状态回传 | |
project | stm32f10x_bb_bt | STM32F103裸机(BB:bare board)蓝牙工程 |
stm32f407_bb_bt | STM32F407裸机(BB:bare board)蓝牙工程 | |
stm32f412_bb_bt | STM32F412裸机(BB:bare board)蓝牙工程 | |
linux_bt | Linux 蓝牙工程 | |
python_tool | convert_binayr_file_to_array.py | 把二进制文档转换为数据的python工具 |
corvert_opcode_to_ogf_ocf.py | 把HCI opcode转换为OGF,OCF |
在bt_config.h中配置你想要的功能,比如debug/profile enable/paring mode/chipset select/spec profile config...
前提条件:1)Keil安装 2)STM32F1/STM32F4对应的pack包 3)Download工具(我们选择的是ST-LINK)
打开工程project下的对应的stm32f10x_bb_bt/stm32f10x_bb_bt/stm32f412_bb_bt直接编译下载即可
前提条件:
1)USB转UART工具(H4 transport需要硬件流控)并且接线正确,根据丝印TX接TX,RX接RX,CTS接CTS,RTS接RTS,VCC5V,GND
2)一般需要给串口权限,比如sudo chmod 777 /dev/ttyUSB0(如果不是这个路径要修改code)
打开工程project下的linux_bt make一下,生成bt_demo后直接运行即可
目前我们的蓝牙协议栈可以在STM32F103以及在Linux跑起来,蓝牙芯片是CSR8311,支持
PROTOCOL:HCI L2CAP RFCOMM SDP AVDTP AVCTP ATT SMP
PROFILE: HFP A2DP AVRCP PBAP SPP GATT
希望会有更多的人来加入进来一起协作开发profile以及蓝牙芯片的工作。
标题 | Sub Feature | GATTC API | GATTC Callback | GATTS API | GATTS Callcak | 备注 |
---|---|---|---|---|---|---|
版本 | GATTC: core 5.3 GATTS: core 5.3 |
/ | / | / | / | |
GATTS Register | / | / | 50% | / | ||
GATT Connect | 0% | 100% | 0% | 100% | ||
GATT Disconnect | 0% | 100% | 0% | 100% | ||
SERVER CONFIGURATION | Exchange MTU | 100% | 100% | 100% | 100% | |
PRIMARY SERVICE DISCOVERY | Discover All Primary Services | 100% | 100% | 100% | 100% | |
Discover Primary Service by Service UUID | 100% | 100% | / | 0% | ||
RELATIONSHIP DISCOVERY | Find Included Services | 100% | 0% | 0% | 0% | |
CHARACTERISTIC DISCOVERY | Discover All Characteristics of a Service | 100% | 100% | 0% | 0% | |
Discover Characteristics by UUID | 0% | 0% | 0% | 0% | ||
CHARACTERISTIC DESCRIPTOR DISCOVERY | Discover All Characteristic Descriptors | |||||
CHARACTERISTIC VALUE READ | Read Characteristic Value | |||||
Read Using Characteristic UUID | ||||||
Read Long Characteristic Values | ||||||
Read Multiple Characteristic Values | ||||||
Read Multiple Variable Length Characteristic Values | ||||||
CHARACTERISTIC VALUE WRITE | Write Without Response | |||||
Signed Write Without Response | ||||||
Write Characteristic Value | ||||||
Write Long Characteristic Values | ||||||
Reliable Writes | ||||||
CHARACTERISTIC VALUE NOTIFICATION | Notifications | |||||
Multiple Variable Length Notifications | ||||||
CHARACTERISTIC VALUE INDICATIONS | Indications | |||||
CHARACTERISTIC DESCRIPTORS | Read Characteristic Descriptors | |||||
Read Long Characteristic Descriptors | ||||||
Write Characteristic Descriptors | ||||||
Write Long Characteristic Descriptors |