MCU---HLK-W801 Bluetooth BLE function test

Publisher:创新脑细胞Latest update time:2022-08-01 Source: csdnKeywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Speaking of Bluetooth, everyone should be familiar with it now. Almost all office workers will choose Bluetooth headsets instead of traditional wired headsets, in order to listen to music in daily life without being noticed by the boss.


Briefly introduce some knowledge about Bluetooth.


Bluetooth is a short-range wireless communication technology that enables data exchange between fixed and mobile devices. BR/EDR Bluetooth before Bluetooth 3.0 is generally called traditional Bluetooth, while LE Bluetooth under the Bluetooth 4.0 specification is called low-power Bluetooth.

The Bluetooth 4.0 standard includes the traditional Bluetooth module part and the low-power Bluetooth module part, and is a dual-mode standard. Low-power Bluetooth is also developed on the basis of traditional Bluetooth, and is different from traditional modules. Its biggest feature is that it reduces cost and power consumption, and is used in applications with high real-time requirements.

BLE (Bluetooh Low Energy) Bluetooth low energy technology is a short-range, low-cost, interoperable wireless technology that uses many intelligent means to minimize power consumption.

The operating mode of BLE technology is well suited for transmitting data from tiny wireless sensors (exchanging data every half a second) or other peripherals such as remote controls that use fully asynchronous communication. These devices send very small amounts of data (usually a few bytes) and send very infrequently (for example, a few times per second to once per minute or even less).

-----Reference article "Popularize what Bluetooth and BLE are, you will understand them in seconds after reading this"


One of the highlights of W801 is the Bluetooth module, which supports BT/BLE dual-mode working mode and BT/BLE4.2 protocol.


Let's take a look at how to debug this module.


Enable the BT test module in the SDK

First configure the macro definition in wm_demo.h to enable the BT function

Then compile the code and burn it

If you don't know how to do it here, refer to another article in the directory "MCU-HLK-W801 Development Environment Construction"


Installing the test tool

If you want to debug Bluetooth on Windows 10, here is a software recommended, Bluetooth LE Explorer. You can search and install it in Microsoft Store.

I have to mention the Microsoft App Store here. It’s the first time I used it today and it’s pretty good.


After the software is opened, this interface appears

Test steps

1. Turn on the Bluetooth module

Enter t-bt-on in the serial port to turn on the Bluetooth module

2. Turn on the Bluetooth host

Type t-ble-server-on to turn on blehost


3. Pairing and connection

Click start to start scanning

Find our development board WM-XXX

Click on the Pair below

Then we click on the device icon, then click Start Transaction, and then click Handle2, 2 should be the downlink channel

Enter the data and click Write

The command line can receive data

Go back and click Handle4, check this, and you can receive data reports.

Is not it simple


Code Analysis

The function triggered by the command line is in wm_bt_app.c

The tls_ble_server_demo_api_init function is called in demo_ble_server_on

Then you can analyze the code structure based on the information printed out by debugging.

Here you need to study in depth.

Keywords:MCU Reference address:MCU---HLK-W801 Bluetooth BLE function test

Previous article:MCU---HLK-W801 Bluetooth remote control lighting
Next article:MCU---HLK-W801 development environment construction

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号