3293 views|6 replies

295

Posts

0

Resources
The OP
 

[Qinheng RISC-V core CH582] 6 BLE_UART routine evaluation [Copy link]

 This post was last edited by kit7828 on 2022-4-11 14:46

There is a BLE_UART routine in Qinheng's BLE routine, and it is rare to see the file

txt file in the folder

There are very few explanations of the routines in the entire Qinheng routines, so I also hope that Qinheng officials can add corresponding instructions to the demo routines to facilitate evaluation and learners.

BLE programming is relatively complicated due to the protocol. To be honest, if it weren't for the pressure of evaluation or product development, I probably wouldn't have bothered with it for a long time.

The BLE demo is compiled and downloaded to the development board. Unlike previous routines, the download and verification time is much longer.

After downloading, connect to the serial port

At this time, open the BLE debugging assistant on the mobile phone (refer to the previous evaluation routine, [Qinheng RISC-V core CH582] 5 Bluetooth routine initial evaluation and environment construction )

You can see ch583_ble_uart, after connecting

The serial port displays the above information, while the mobile app displays the following interface

This assistant tool can send and receive, but only the one at the bottom can be sent

The receiver can read the corresponding information by clicking the corresponding read button.

Device Information Here you can basically read the string information

There is only one person sending the message

After receiving the information, the serial port will prompt that the length information has been received

BLE RX DATA len:7

After a slight modification in the code, the received information can be displayed.

For testing convenience, only string information is processed

case BLE_UART_EVT_BLE_DATA_RECIEVED:
            PRINT("BLE RX DATA len:%d\r\n",p_evt->data.length);
            char * str = p_evt->data.p_data;
            str[p_evt->data.length] = 0x00;
            PRINT("BLE RX DATA:%s \n",p_evt->data.p_data);
            //for notify back test
            //to ble
            uint16_t to_write_length = p_evt->data.length;
            app_drv_fifo_write(&app_uart_rx_fifo,(uint8_t *)p_evt->data.p_data, &to_write_length );
            tmos_start_task( Peripheral_TaskID, UART_TO_BLE_SEND_EVT,2);
            //end of nofify back test

            //ble to uart
            app_uart_tx_data((uint8_t *)p_evt->data.p_data,p_evt->data.length);

            break;

In this way, the specific string received can be printed

It is also a more detailed test of the evaluation

After processing the received character information, Bluetooth control should be possible.

void app_uart_tx_data(uint8_t *data,uint16_t length)
{
    uint16_t write_length = length;
    if(strcmp(data,"LED1 ON"))  HAL_TURN_ON_LED1();
    if(strcmp(data,"LED1 OFF"))  HAL_TURN_OFF_LED1();
    app_drv_fifo_write(&app_uart_tx_fifo,data,&write_length);
}

In this way, Bluetooth can control more.

At least I will try GAPRole and GATT programming when I have a little more free time at work in the future.

This post is from Domestic Chip Exchange

Latest reply

Thanks for the suggestion, we will consider adding more comments.   Details Published on 2022-4-11 13:52
 
 

6587

Posts

0

Resources
2
 

Qinheng's official website does not explain much about the BLE_UART routines of CH582

This post is from Domestic Chip Exchange
 
 
 

6841

Posts

11

Resources
3
 
You are so proficient in mastering Bluetooth. Thanks for sharing. It’s been a pain. I look forward to more elegant works.
This post is from Domestic Chip Exchange

Comments

Thanks for the encouragement. I always feel that GATT is too difficult to learn.  Details Published on 2022-4-11 14:44
 
 
 

303

Posts

5

Resources
4
 

After learning this, I think this idea is good. I will refer to it and learn to modify the code to control the transmission of sensor data in a couple of days.

This post is from Domestic Chip Exchange
 
 
 

7

Posts

0

Resources
5
 

Thanks for the suggestion, we will consider adding more comments.

This post is from Domestic Chip Exchange

Comments

Thank you, I will definitely give it a good review  Details Published on 2022-4-11 14:44
 
 
 

295

Posts

0

Resources
6
 
lugl4313820 posted on 2022-4-9 18:43 You are so proficient in Bluetooth. Thank you for sharing. I look forward to more elegant works.

Thanks for the encouragement. I always feel that GATT is too difficult to learn.

This post is from Domestic Chip Exchange
 
 
 

295

Posts

0

Resources
7
 
WCH_Risc5 posted on 2022-4-11 13:52 Thanks for your comments, we will consider adding more comments.

Thank you, I will definitely give it a good review

This post is from Domestic Chip Exchange
 
 
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Related articles more>>
Featured Posts
Application skills/Software and hardware implementation of serial communication between PIC16 series microcontroller and PC

Abstract: This paper introduces a method of using PIC16F84 microcontroller to realize serial communication with PC, ...

Could you please help me see how to filter this switching power supply circuit?

As the title says, the ACDC switching power supply outputs 5V voltage through LDO. How to filter it next? Below is the ...

Commonly used techniques in PCB design

Commonly used techniques in PCB design In the current mainstream market, the most commonly used circuit diagram drawing ...

34 "Ten Thousand Miles" Raspberry Pi Car——Installation of ROS Noetic on Ubuntu System

This post was last edited by lb8820265 on 2022-4-16 00:54 Ubuntu is installed for the purpose of installing ROS. The of ...

OTL circuit analysis problems

As shown in the figure, the OTL circuit Why can resistors R5, R6 and diode D1 ensure that transistors V2 and V3 are in ...

[Image recognition classification & motion detection & analog signal processing system based on Raspberry Pi 400, fifth post] Project conclusion & documentation - 11.0...

This post was last edited by donatello1996 on 2022-11-3 14:06 Project Summary & Documentation - 11.03 Update 653944 ...

Book activity award: "RT-Thread Device Driver Development Guide"

First of all, we would like to thank the netizens for participating in the reading activity of "RT-Thread Device Driver ...

Complain about it

I’m currently working in a company doing hardware design, but the company is too remote to recruit experienced software ...

Python Programming Quick Start - Python Software Installation

I plan to follow the book introduction and gradually get started with Python. This time I will share how to install Pyth ...

Building an Xx431?

Building an Xx431? Hey uu guys! How do you feel after finishing a six-day work week? My condition is OK. I can always fi ...

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list