Bluetooth protocol stack development board STM32F1 runs Bluetooth protocol stack-traditional Bluetooth serial protocol SPP demonstration and implementation principle

Zero. Overview

Mainly introduce the Bluetooth protocol stack development board to run the traditional Bluetooth serial protocol SPP AT command and the upper computer operation steps, and principles

1. Statement

We will continue to update this column in a serialized manner. The updated content of this column is planned as follows:

The first article: Comprehensive introduction to Bluetooth, mainly introduces some concepts of Bluetooth, background, development track, introduction of Bluetooth in the market, and introduction of Bluetooth development board.

The second chapter: Introduction to the Transport layer, mainly introduces the Bluetooth protocol stack and the hardware transmission protocol before the Bluetooth chip, such as H4, H5, BCSP based on UART, H2 based on USB, etc.

The third chapter: Introduction to traditional Bluetooth controller, mainly introduces the introduction of traditional Bluetooth chips, including radio frequency layer (RF), baseband layer (baseband), link management layer (LMP), etc.

The fourth chapter: Introduction to traditional Bluetooth host, mainly introduces the traditional Bluetooth protocol stack, such as HCI, L2CAP, SDP, RFCOMM, HFP, SPP, HID, AVDTP, AVCTP, A2DP, AVRCP, OBEX, PBAP, MAP, etc. Agreement.

Chapter 5: Introduction to Low Energy Bluetooth Controller, mainly introduces low energy Bluetooth chips, including physical layer (PHY), link layer (LL)

Chapter 6: Introduction to low-power Bluetooth host, introduction to low-power Bluetooth protocol stack, including HCI, L2CAP, ATT, GATT, SM, etc.

Chapter 7: Introduction to Bluetooth chips, mainly introduces the initialization process of some Bluetooth chips, based on the extension of HCI vendor command

The eighth chapter: appendix, mainly introduces the introduction of the above commonly used terms and the introduction of some special processes.

In addition, the development board is shown below, which is the best set of people who want to learn the Bluetooth protocol stack. In order to better learn the Bluetooth protocol stack, believe me, after learning this set of videos, you will have the ability to modify any protocol stack (such as bluez under Linux, bluedroid under Android).

-------------------------------------------------------------------------------------------------------------------------

CSDN college link (enter to choose the course you want to learn): https://edu.csdn.net/lecturer/5352?spm=1002.2001.3001.4144

Bluetooth exchange button group: 970324688

Github code: https://github.com/sj15712795029/bluetooth_stack

Get the development board: https://item.taobao.com/item.htm?spm=a1z10.1-cs.w4004-22329603896.18.5aeb41f973iStr&id=622836061708

Bluetooth learning catalog : https://blog.csdn.net/XiaoXiaoPengBo/article/details/107727900

--------------------------------------------------------------------------------------------------------------------------

2. STM32 Bluetooth protocol stack encapsulation uses AT command to realize the communication of serial protocol SPP

The steps are as follows:

Step 1) Prepare the code and download the latest code from github (the Github connection is introduced above)

Step 2) Connect the hardware (plug the module, ST-LINK, TYPE-C debug first, press the button to see the blue power supply, etc.)

Step 3) Open project\stm32f10x_bb_csr8x11_bt\stm32f10x_bb_csr8x11.uvprojx under the Keil project folder and configure SPP enable (define PROFILE_SPP_ENABLE to 1 in bt_config.h)

Step 4) Compile and download

A few points to note in this section:

  • Download requires ST-LINK driver, I have placed it in the software tool folder in the download material
  • The STM32 F1 pack must be available. I have placed it under the MDK in the software tool folder. I have not installed it before. The name is as follows:

   

  • Select ST-LINK for the debug download

     

  • When downloading, check Use micro lib

     

Step 6) Open the serial port tool (I use XCOM), and then do the initialization action, hit BT_START in the sending serial port, click send, and the following log shows that the initialization has passed, and then we are ready to start testing SPP ( note: no Check to send new line, otherwise it will parse error)

Step 6) Use the mobile phone's SPP software (in 3-software tools\bt_spp_apk) to connect to our development board, the connection is successful as shown in the figure, and then hit SPP_SEND to send a fixed string (written in the code, you can modify it at will ), and then we can also receive the data sent by the apk through the development board

3. The STM32 Bluetooth protocol stack uses the host computer to realize the communication of the serial port protocol SPP

The first 4 steps of using the host computer are the same as AT, we will directly talk about the fifth step.

Open mcu_bt_tool.exe in our project source 1-BLUETOOTH\mcu_bt_tool\mcu_bt_tool\mcu_bt_tool\bin\Debug, of course you can also open the project directly with VS2010

Step 5) Turn on the host computer, turn on the serial port, and turn on the Bluetooth function

Step 6) Enter the Bluetooth serial interface, after connecting, the connection status, connection address and space will be available, the interface is simple and easy to use, there is nothing to understand

In addition: Pay attention to a few points when using the host computer:

① mcu_bt_tool.exe If you want to take the executable file to another path for separate execution, you must put Newtonsoft.Json.dll and exe in the same path, because the host computer communicates with STM32 using json

② Because the search is currently enabled with EIR and RSSI, it will repeatedly come up to the same device. I did not perform display filtering based on the same Bluetooth address. If you are interested, you can add this one.

Four. Serial port tool AT command and the principle of the upper computer to realize the search

https://blog.csdn.net/XiaoXiaoPengBo/article/details/108414679

The principle is in the fourth section of the above link

 

 

Guess you like

Origin blog.csdn.net/XiaoXiaoPengBo/article/details/108780973