Preface: I use Qinheng's Bluetooth, and its Bluetooth function is integrated into the processor. I read the datasheet of Artly's AT32WB415. The Bluetooth and MCU are separated in the chip architecture and communicate through a serial port. In this way, it can be understood that the MCU sends AT commands to the Bluetooth, which is similar to the MCU sending and receiving to the 4G module. Everyone is welcome to correct me.
1. Hardware Interpretation
I learned about the resources and functions of the board through the 1.1 Features in the hardware manual UM_AT_START_WB415_V1.10.pdf, as shown in the figure.
The AT32WB415CCU7-7 processor is divided into two parts: Bluetooth 5.0 dual-mode and microcontroller. Here is a functional block diagram on page 9 of the data sheet. As shown in the figure, the two parts communicate through the serial port.
The above information can be found in the resource address of the Yatli official website . For specific steps, go to the official website homepage-->pull down to the bottom and find the corresponding product, such as the AT32WB415 series, as shown in the figure below, click to enter.
The page you enter is the knowledge page required for the development board. Read it from beginning to end. Of course, you can also jump directly to the resource download according to the jump link on the upper right side.
Download the Datasheet and development board resources as shown in the figure below.
After downloading is complete, open and read the corresponding manual, as shown in the figure.
2. Bluetooth + MCU function compilation
In the previous article, the Keil development environment for Bluetooth and MCU has been built, and the ble compilation has been completed. Today, we will compile the MCU routine and download a simple mobile phone Bluetooth control to turn on and off the light.
When compiling some MCU routines, an error occurred, as shown in the figure. This should not happen. After checking, I found that there should be no Chinese, so I changed the path and recompiled it, and the compilation was successful.
Open the Bluetooth program and compile it as shown in the figure.
3. Download test
- First, download the MCU+BLE program on the board
Open the ICP download software, connect the MicroUSB interface to the debug download port AT-Link, and select the MCU+BLE program to be downloaded, as shown in the figure. Note that when loading the ble program, modify the address, and the software will prompt.
After loading the program, click Connect AT-Link, or you can connect first and then click the Download button to download the program, as shown in the figure.
After the download is successful, a prompt will appear saying that the download is successful.
- Next, download the LIGHTBLE APP on your phone.
I searched for LIGHTBLE on my phone and found the program shown in the first picture below. I just downloaded it. I opened the software as shown in the second picture and typed wb, and WB415-GATT came out.
Click to connect WB415-GATT, the connection is successful as shown in the third picture, and the board's Bluetooth is connected. Click 0xC101, read and write Bluetooth without return function, as shown in the fourth picture, click Wrtie new value, as shown in the fifth picture, enter 01, click Done, LED2 on the board lights up, then click Write new value, enter 00, click Done, LED2 on the board turns off, so there are two data under Wtire new value as shown in the sixth picture, click 01, the light turns on, click 00, the light turns off, the response is very fast.