中级
30 分钟

通过BGX13S22GA-V31和STM32F302VC,前所未有地体验蓝牙

连接可能性,赋予生活方式力量

BLE 7 Click with CLICKER 4 for STM32F302VCT6

已发布 7月 22, 2025

点击板

BLE 7 Click

开发板

CLICKER 4 for STM32F302VCT6

编译器

NECTO Studio

微控制器单元

STM32F302VC

告别纠结的电线,拥抱简化连接的世界,让您轻松地流式传输、分享和控制您的设备。

A

A

硬件概览

它是如何工作的?

BLE 7 Click基于Silicon Labs的BGX13S22GA-V31模块,具有一些令人印象深刻的特性,包括符合蓝牙5低功耗标准、通过命令API进行GPIO控制、加密配对和连接以及集成DC-DC转换器。BGX13S22GA-V31模块通过串行接口消除了蓝牙固件开发的复杂性,该接口可以作为原始数据流或通过抽象的命令API控制设备。BGX13S22GA-V31可促进设备到设备的电缆替代连接,或通过Xpress蓝牙移动库与移动设备通信。该设备集成了符合蓝牙5标准的堆栈,以未来保护应用程序,因为蓝牙5的采用增加。该设备

针对需要超小尺寸、可靠、高性能射频、低功耗和快速上市的应用而设计。BGX13S22GA-V31还集成了高性能、超稳健的天线,需要最小的PCB、塑料和金属间隙。除非另有说明,最小和最大值代表供电电压、工艺变化和工作温度下的最差条件。BGX13S模块只有一个外部供电引脚(VDD)。电气规格中提到了几个内部供电轨,其连接根据发射功率配置而变化。BGX13S创建了一个符合蓝牙5标准的BLE电缆替代接口,促进了与第二个嵌入式或移动设备的BLE链接。嵌入式MCU控制设备,并

通过串行接口和控制信号在BLE链路上进行通信。存储在非易失性存储器中并通过串行接口可配置的参数调整设备的性能特征。Silicon Labs为Blue Gecko Xpress设备提供iOS和Android移动库,以加速移动开发并简化通信。该Click板™只能使用3.3V逻辑电压级别。在使用具有不同逻辑电压级别的MCU之前,板子必须执行适当的逻辑电压级别转换。此外,它配备有一个包含函数和示例代码的库,可用作进一步开发的参考。

BLE 7 Click top side image
BLE 7 Click bottom side image

功能概述

开发板

Clicker 4 for STM32F3 是一款紧凑型开发板,作为完整的解决方案而设计,可帮助用户快速构建具备独特功能的定制设备。该板搭载 STMicroelectronics 的 STM32F302VCT6 微控制器,配备四个 mikroBUS™ 插槽用于连接 Click boards™、完善的电源管理功能以及其他实用资源,是快速开发各类应用的理想平台。其核心 MCU STM32F302VCT6 基于高性能 

Arm® Cortex®-M4 32 位处理器,运行频率高达 168MHz,处理能力强大,能够满足各种高复杂度任务的需求,使 Clicker 4 能灵活适应多种应用场景。除了两个 1x20 引脚排针外,板载最显著的连接特性是四个增强型 mikroBUS™ 插槽,支持接入数量庞大的 Click boards™ 生态系统,该生态每日持续扩展。Clicker 4 各功能区域标识清晰,界面直观简洁,极大

提升使用便捷性和开发效率。Clicker 4 的价值不仅在于加速原型开发与应用构建阶段,更在于其作为独立完整方案可直接集成至实际项目中,无需额外硬件修改。四角各设有直径 4.2mm(0.165")的安装孔,便于通过螺丝轻松固定。对于多数应用,只需配套一个外壳,即可将 Clicker 4 开发板转化为完整、实用且外观精美的定制系统。

CLICKER 4 for STM32F302VCT6 double image

微控制器概述 

MCU卡片 / MCU

STM32F302VC Image

建筑

ARM Cortex-M4

MCU 内存 (KB)

256

硅供应商

STMicroelectronics

引脚数

100

RAM (字节)

40960

使用的MCU引脚

mikroBUS™映射器

General-Purpose I/0
PC4
AN
Reset
PC15
RST
UART RTS
PA4
CS
NC
NC
SCK
NC
NC
MISO
NC
NC
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
General-Purpose I/0
PE9
PWM
UART CTS
PD0
INT
UART TX
PA2
TX
UART RX
PA3
RX
NC
NC
SCL
NC
NC
SDA
NC
NC
5V
Ground
GND
GND
1

“仔细看看!”

Click board™ 原理图

BLE 7 Click Schematic schematic

一步一步来

项目组装

PIC32MZ MXS Data Capture Board front image hardware assembly

从选择您的开发板和Click板™开始。以CLICKER 4 for STM32F302VCT6作为您的开发板开始。

PIC32MZ MXS Data Capture Board front image hardware assembly
Thermo 21 Click front image hardware assembly
Board mapper by product6 hardware assembly
Necto image step 2 hardware assembly
Necto image step 3 hardware assembly
Necto image step 4 hardware assembly
Necto image step 5 hardware assembly
Necto image step 6 hardware assembly
PIC32MZ MXS Data Capture Board NECTO MCU Selection Step hardware assembly
Necto No Display image step 8 hardware assembly
Necto image step 9 hardware assembly
Necto image step 10 hardware assembly
Necto image step 11 hardware assembly

实时跟踪您的结果

应用程序输出

1. 应用程序输出 - 在调试模式下,“应用程序输出”窗口支持实时数据监控,直接提供执行结果的可视化。请按照提供的教程正确配置环境,以确保数据正确显示。

2. UART 终端 - 使用UART Terminal通过USB to UART converter监视数据传输,实现Click board™与开发系统之间的直接通信。请根据项目需求配置波特率和其他串行设置,以确保正常运行。有关分步设置说明,请参考提供的教程

3. Plot 输出 - Plot功能提供了一种强大的方式来可视化实时传感器数据,使趋势分析、调试和多个数据点的对比变得更加直观。要正确设置,请按照提供的教程,其中包含使用Plot功能显示Click board™读数的分步示例。在代码中使用Plot功能时,请使用以下函数:plot(insert_graph_name, variable_name);。这是一个通用格式,用户需要将“insert_graph_name”替换为实际图表名称,并将“variable_name”替换为要显示的参数。

软件支持

库描述

该库包含 BLE 7 Click 驱动程序的 API。

关键功能:

  • ble7_reset - 此函数允许用户重置BGX模块

  • ble7_send_command - 此函数允许用户向BGX模块传输数据

开源

代码示例

完整的应用程序代码和一个现成的项目可以通过NECTO Studio包管理器直接安装到NECTO Studio 应用程序代码也可以在MIKROE的GitHub账户中找到。

/*!
 * \file 
 * \brief Ble7 Click example
 * 
 * # Description
 * This example reads and processes data from BLE 7 Clicks.
 *
 * The demo application is composed of two sections :
 * 
 * ## Application Init 
 * Initializes the driver and configures the Click board.
 * 
 * ## Application Task  
 * Checks for the received data, reads it and replies with a certain message.
 * 
 * ## Additional Function
 * - ble7_process ( ) - Logs all received messages on UART, and sends the certain message back 
 * to the connected device.
 * 
 * @note
 * We have used the BLE Scanner smartphone application for the test. 
 * A smartphone and the Click board must be paired in order to exchange messages with each other.
 * For more information about the BGX module commands, please refer to the following link:
 * https://docs.silabs.com/gecko-os/1/bgx/latest/commands
 * 
 * \author MikroE Team
 *
 */
// ------------------------------------------------------------------- INCLUDES

#include "board.h"
#include "log.h"
#include "ble7.h"
#include "string.h"

#define PROCESS_COUNTER 10
#define PROCESS_RX_BUFFER_SIZE 200

// ------------------------------------------------------------------ VARIABLES

#define BLE7_ENABLE_ECHO                        "set sy c e 1"
#define BLE7_CLEAR_BONDING                      "clrb"
#define BLE7_ENABLE_BONDING                     "set bl e b 1"
#define BLE7_ENABLE_PAIRING                     "set bl e p any"
#define BLE7_SET_ADVERTISING_ON                 "adv high"
#define BLE7_SET_ADVERTISING_HIGH_DURATION      "set bl v h d 120"
#define BLE7_SET_DEVICE_NAME                    "set sy d n \"BLE7-DEVICE\""
#define BLE7_SAVE_CONFIGURATION                 "save"
#define BLE7_SWITCH_TO_STREAM_MODE              "str"

static ble7_t ble7;
static log_t logger;
static uint8_t data_mode = 0;
static uint8_t config_mode = 0;
static char current_parser_buf[ PROCESS_RX_BUFFER_SIZE ];

// ------------------------------------------------------- ADDITIONAL FUNCTIONS

static int8_t ble7_process ( void )
{
    int32_t rsp_size;
    uint16_t rsp_cnt = 0;
    int8_t ret_flag = 0;
    
    char uart_rx_buffer[ PROCESS_RX_BUFFER_SIZE ] = { 0 };
    uint8_t check_buf_cnt;
    uint8_t process_cnt = PROCESS_COUNTER;
    
    // Clear current buffer
    memset( current_parser_buf, 0, PROCESS_RX_BUFFER_SIZE ); 
    
    while( process_cnt != 0 )
    {
        rsp_size = ble7_generic_read( &ble7, uart_rx_buffer, PROCESS_RX_BUFFER_SIZE );

        if ( rsp_size > 0 )
        {  
            // Validation of the received data
            for ( check_buf_cnt = 0; check_buf_cnt < rsp_size; check_buf_cnt++ )
            {
                if ( uart_rx_buffer[ check_buf_cnt ] == 0 ) 
                {
                    uart_rx_buffer[ check_buf_cnt ] = 13;
                }
            }
            // Storages data in current buffer
            rsp_cnt += rsp_size;
            if ( rsp_cnt < PROCESS_RX_BUFFER_SIZE )
            {
                strncat( current_parser_buf, uart_rx_buffer, rsp_size );
            }
            
            // Clear RX buffer
            memset( uart_rx_buffer, 0, PROCESS_RX_BUFFER_SIZE );
            
            if ( strstr( current_parser_buf, "Command failed" ) ) 
            {
                ret_flag = 0;
                return ret_flag;
            }
            
            if ( strstr( current_parser_buf, "Success" ) ) 
            {
                ret_flag = 1;
            }
            
            if ( strstr( current_parser_buf, "STREAM_MODE" ) ) 
            {
                data_mode = 1;
                ret_flag = 1;
            }
            
            if ( strstr( current_parser_buf, "COMMAND_MODE" ) ) 
            {
                data_mode = 0;
                ret_flag = 1;
            }
            
            if ( ret_flag == 1 )
            {
                log_printf( &logger, "%s", current_parser_buf );
                return ret_flag;
            }
            
            if ( config_mode == 0 )
            {   
                log_printf( &logger, "%s", current_parser_buf );
                if ( data_mode == 0 ) 
                {
                    ble7_send_command( &ble7, "send Hello" );
                    Delay_ms ( 1000 );
                    Delay_ms ( 1000 );
                    ble7_send_command( &ble7, "send MikroE" );
                }
                else
                {
                    ble7_send_command( &ble7, "Hello" );
                    Delay_ms ( 1000 );
                    Delay_ms ( 1000 );
                    ble7_send_command( &ble7, "MikroE" );
                }
            }
        } 
        else 
        {
            process_cnt--;
            
            // Process delay 
            Delay_ms ( 100 );
        }
    }
    
    ret_flag = 0;
    return ret_flag;
}

// ------------------------------------------------------ APPLICATION FUNCTIONS

void application_init ( void )
{
    log_cfg_t log_cfg;
    ble7_cfg_t cfg;

    /** 
     * Logger initialization.
     * Default baud rate: 115200
     * Default log level: LOG_LEVEL_DEBUG
     * @note If USB_UART_RX and USB_UART_TX 
     * are defined as HAL_PIN_NC, you will 
     * need to define them manually for log to work. 
     * See @b LOG_MAP_USB_UART macro definition for detailed explanation.
     */
    LOG_MAP_USB_UART( log_cfg );
    log_init( &logger, &log_cfg );
    log_info( &logger, "---- Application Init ----" );

    //  Click initialization.

    ble7_cfg_setup( &cfg );
    BLE7_MAP_MIKROBUS( cfg, MIKROBUS_1 );
    ble7_init( &ble7, &cfg );
    Delay_1sec( );
    
    log_printf( &logger, "Configuring the module...\r\n" );
    Delay_1sec( );
    config_mode = 1;
    
    do 
    {
        ble7_reset( &ble7 );
        Delay_1sec( );
    }
    while( ble7_process(  ) != 1 );
    
    do 
    {
        ble7_send_command( &ble7, BLE7_CLEAR_BONDING );
        Delay_1sec( );
    }
    while( ble7_process(  ) != 1 );
    
    do 
    {
        ble7_send_command( &ble7, BLE7_ENABLE_ECHO );
        Delay_1sec( );
    }
    while( ble7_process(  ) != 1 );
    
    do 
    {
        ble7_send_command( &ble7, BLE7_ENABLE_PAIRING );
        Delay_1sec( );
    }
    while( ble7_process(  ) != 1 );
    
    do 
    {
        ble7_send_command( &ble7, BLE7_ENABLE_BONDING );
        Delay_1sec( );
    }
    while( ble7_process(  ) != 1 );
    
    do 
    {
        ble7_send_command( &ble7, BLE7_SET_DEVICE_NAME );
        Delay_1sec( );
    }
    while( ble7_process(  ) != 1 );
    
    do 
    {
        ble7_send_command( &ble7, BLE7_SET_ADVERTISING_ON );
        Delay_1sec( );
    }
    while( ble7_process(  ) != 1 );
    
    do 
    {
        ble7_send_command( &ble7, BLE7_SET_ADVERTISING_HIGH_DURATION );
        Delay_1sec( );
    }
    while( ble7_process(  ) != 1 );
    
    do 
    {
        ble7_send_command( &ble7, BLE7_SAVE_CONFIGURATION );
        Delay_1sec( );
    }
    while( ble7_process(  ) != 1 );
    
    do 
    {
        ble7_send_command( &ble7, BLE7_SWITCH_TO_STREAM_MODE );
        Delay_1sec( );
    }
    while( ble7_process(  ) != 1 );
    
    config_mode = 0;
    log_printf( &logger, "The module has been configured.\r\n" );
    Delay_1sec( );
}

void application_task ( void )
{
    ble7_process(  );
}

int main ( void ) 
{
    /* Do not remove this line or clock might not be set correctly. */
    #ifdef PREINIT_SUPPORTED
    preinit();
    #endif
    
    application_init( );
    
    for ( ; ; ) 
    {
        application_task( );
    }

    return 0;
}


// ------------------------------------------------------------------------ END

额外支持

资源

喜欢这个项目吗?

'购买此套件' 按钮会直接带您进入购物车,您可以在购物车中轻松添加或移除产品。