通过一个将 NB-IoT 技术的优势相结合的平台,将您的物联网连接提升到新的高度,包括功耗效率和广覆盖,为您提供可靠且安全的物联网体验。
A
A
硬件概览
它是如何工作的?
5G NB IoT Click 基于 ENS22,这是来自泰利斯的 NB-IoT 无线模块平台,为物联网提供高效未来的 5G 连接性。ENS22 物联网无线模块将未来的 5G 连接性与扩展覆盖范围和增强安全功能相结合,以连接和保护工业物联网解决方案。ENS22 物联网无线模块可提供高达 27 Kbit/s 的下行速度和 63 Kbit/s 的上行速度的数据速率,非常适用于长寿命的仅数据解决方案,例如公用事业计量器和智能城市解决方案。5G NB IoT Click 具有集成的 NB-IoT 收发器,多频段移动蜂窝设备。该模块可在 698-960 MHz 和 1695-2180MHz 的频段上运
行,系统带宽为 200 kHz。它设计用于使用 3GPP NB-IoT 无线协议与移动网络运营商 (MNO) 基础设备进行通信。ENS22 物联网模块平台提供一套专为物联网应用优化的 NB-IoT 连接解决方案,并准备支持 Release 14,无需迁移到新的芯片组。它提供了五频段 LTE (3, 5, 8, 20, 28) 连接,具有深室内覆盖和农村地区的扩展范围。该模块提供了内置的 IP 栈,支持一系列由增强的安全概念保护的互联网服务。增量固件空中更新 (FOTA) 允许仅修订需要更新的代码部分,节省功耗和带宽,延长物联网解决方案的寿命。该模块的简化电源
设计和先进的管理系统延长了电池寿命并改善了总拥有成本。这个 Click board™ 配备了 USB C 类连接器。它允许模块由个人计算机供电和配置。FT230X IC 需要驱动程序才能工作。FTDI 在其官方驱动程序下载网页上提供所有主要操作系统的驱动程序。此外,Windows 操作系统的驱动程序包含在下面的下载部分中。5G NB IoT Click 具有完全集成的锂离子或锂聚合物电池充电器,与模块相结合可达到 10 ~ 15 年的电池寿命,用户完全可以单独使用它,只需电池供电。
功能概述
开发板
Nucleo-64 搭载 STM32F410RB MCU 提供了一种经济高效且灵活的平台,供开发者探索新想法并原型设计他们的项目。该板利用 STM32 微控制器的多功能性,使用户能够为他们的项目选择最佳的性能与功耗平衡。它配备了 LQFP64 封装的 STM32 微控制器,并包含了如用户 LED(同时作为 ARDUINO® 信号)、用户和复位按钮,以及 32.768kHz 晶体振荡器用于精确的计时操作等基本组件。Nucleo-64 板设计考虑到扩展性和灵活性,它特有的 ARDUINO® Uno
V3 扩展连接器和 ST morpho 扩展引脚头,提供了对 STM32 I/O 的完全访问,以实现全面的项目整合。电源供应选项灵活,支持 ST-LINK USB VBUS 或外部电源,确保在各种开发环境中的适应性。该板还配备了一个具有 USB 重枚举功能的板载 ST-LINK 调试器/编程器,简化了编程和调试过程。此外,该板设计旨在简化高级开发,它的外部 SMPS 为 Vcore 逻辑供电提供高效支持,支持 USB 设备全速或 USB SNK/UFP 全速,并内置加密功能,提升了项目的功效
和安全性。通过外部 SMPS 实验的专用连接器、 用于 ST-LINK 的 USB 连接器以及 MIPI® 调试连接器,提供了更多的硬件接口和实验可能性。开发者将通过 STM32Cube MCU Package 提供的全面免费软件库和示例得到广泛支持。这些,加上与多种集成开发环境(IDE)的兼容性,包括 IAR Embedded Workbench®、MDK-ARM 和 STM32CubeIDE,确保了流畅且高效的开发体验,使用户能够充分利用 Nucleo-64 板在他们的项目中的能力。
微控制器概述
MCU卡片 / MCU

建筑
ARM Cortex-M4
MCU 内存 (KB)
128
硅供应商
STMicroelectronics
引脚数
64
RAM (字节)
32768
你完善了我!
配件
Click Shield for Nucleo-64 配备了两个专有的 mikroBUS™ 插座,使得所有的 Click board™ 设备都可以轻松地与 STM32 Nucleo-64 开发板连接。这样,Mikroe 允许其用户从不断增长的 Click boards™ 范围中添加任何功能,如 WiFi、GSM、GPS、蓝牙、ZigBee、环境传感器、LED、语音识别、电机控制、运动传感器等。您可以使用超过 1537 个 Click boards™,这些 Click boards™ 可以堆叠和集成。STM32 Nucleo-64 开发板基于 64 引脚封装的微控制器,采用 32 位 MCU,配备 ARM Cortex M4 处理器,运行速度为 84MHz,具有 512Kb Flash 和 96KB SRAM,分为两个区域,顶部区域代表 ST-Link/V2 调试器和编程器,而底部区域是一个实际的开发板。通过 USB 连接方便地控制和供电这些板子,以便直接对 Nucleo-64 开发板进行编程和高效调试,其中还需要额外的 USB 线连接到板子上的 USB 迷你接口。大多数 STM32 微控制器引脚都连接到了板子左右边缘的 IO 引脚上,然后连接到两个现有的 mikroBUS™ 插座上。该 Click Shield 还有几个开关,用于选择 mikroBUS™ 插座上模拟信号的逻辑电平和 mikroBUS™ 插座本身的逻辑电压电平。此外,用户还可以通过现有的双向电平转换器,使用任何 Click board™,无论 Click board™ 是否在 3.3V 或 5V 逻辑电压电平下运行。一旦将 STM32 Nucleo-64 开发板与我们的 Click Shield for Nucleo-64 连接,您就可以访问数百个工作于 3.3V 或 5V 逻辑电压电平的 Click boards™。
LTE 平板旋转天线是提升 3G/4G LTE 设备性能的多功能选择。其频率范围为 700-2700MHz,确保在全球主要蜂窝频段上的最佳连接性。这款平板天线配有 SMA 公头连接器,使其易于直接连接到您的设备或 SMA 模块连接器。它的一个突出特点是其可调角度,可以以 45⁰ 的增量(0⁰/45⁰/90⁰)进行设置,允许您微调天线的方向以获得最佳信号接收。具有 50Ω 的阻抗和 <2.0:1 的电压驻波比 (VSW 比),这款天线确保可靠且高效的连接。5dB 增益、垂直极化和全向辐射模式增强了信号强度,使其适用于各种应用。天线长度为 196mm,宽度为 38mm,提供了一种紧凑但有效的解决方案来改善您的连接性。最高输入功率为 50W,可满足各种设备的需求。
使用的MCU引脚
mikroBUS™映射器
“仔细看看!”
Click board™ 原理图

一步一步来
项目组装
实时跟踪您的结果
应用程序输出
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”替换为要显示的参数。

软件支持
库描述
该库包含 5G NB IoT Click 驱动程序的 API。
关键功能:
c5gnbiot_send_cmd
- 发送命令函数c5gnbiot_set_sim_apn
- 设置 SIM 卡 APN 函数c5gnbiot_send_text_message
- 以 PDU 模式发送短信函数
开源
代码示例
完整的应用程序代码和一个现成的项目可以通过NECTO Studio包管理器直接安装到NECTO Studio。 应用程序代码也可以在MIKROE的GitHub账户中找到。
/*!
* \file
* \brief 5gNbIot Click example
*
* # Description
* This example reads and processes data from 5G NB IoT click.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initializes driver and wake-up module and sets default configuration for connecting device to network.
*
* ## Application Task
* Waits for device to connect to network and then sends an SMS to the selected phone number.
*
* ## Additional Function
* - static void c5gnbiot_clear_app_buf ( void )
* - static void c5gnbiot_error_check( err_t error_flag )
* - static void c5gnbiot_log_app_buf ( void )
* - static void c5gnbiot_check_connection( void )
* - static err_t c5gnbiot_rsp_check ( void )
* - static err_t c5gnbiot_process ( void )
*
* @note
* In order for the example to work, user needs to set the phone number to which he wants
* to send an SMS, and also will need to set an APN and SMSC of entered SIM card.
* Enter valid data for the following macros: SIM_APN, SIM_SMSC and PHONE_NUMBER_TO_MESSAGE.
* E.g.
SIM_APN "vipmobile"
SIM_SMSC "+381610401"
PHONE_NUMBER_TO_MESSAGE "+381659999999"
*
* @author MikroE Team
*
*/
// ------------------------------------------------------------------- INCLUDES
#include "board.h"
#include "log.h"
#include "c5gnbiot.h"
#define APP_OK 0
#define APP_ERROR_DRIVER -1
#define APP_ERROR_OVERFLOW -2
#define APP_ERROR_TIMEOUT -3
#define RSP_OK "OK"
#define RSP_ERROR "ERROR"
#define SIM_APN "" // Set valid SIM APN
#define SIM_SMSC "" // Set valid SMS Service Center Address
#define PHONE_NUMBER_TO_MESSAGE "" // Set Phone number to message
#define MESSAGE_CONTENT "5G NB IoT Click" // Messege content
#define PROCESS_BUFFER_SIZE 300
#define WAIT_FOR_CONNECTION 0
#define CONNECTED_TO_NETWORK 1
static c5gnbiot_t c5gnbiot;
static log_t logger;
static char app_buf[ PROCESS_BUFFER_SIZE ] = { 0 };
static int32_t app_buf_len = 0;
static int32_t app_buf_cnt = 0;
static uint8_t app_connection_status = WAIT_FOR_CONNECTION;
static err_t app_error_flag;
/**
* @brief 5G NB IoT clearing application buffer.
* @details This function clears memory of application buffer and reset its length and counter.
* @note None.
*/
static void c5gnbiot_clear_app_buf ( void );
/**
* @brief 5G NB IoT data reading function.
* @details This function reads data from device and concats data to application buffer.
*
* @return @li @c 0 - Read some data.
* @li @c -1 - Nothing is read.
* @li @c -2 - Application buffer overflow.
*
* See #err_t definition for detailed explanation.
* @note None.
*/
static err_t c5gnbiot_process ( void );
/**
* @brief 5G NB IoT check for errors.
* @details This function checks for different types of errors and logs them on UART.
* @note None.
*/
static void c5gnbiot_error_check( err_t error_flag );
/**
* @brief 5G NB IoT logs application buffer.
* @details This function logs data from application buffer.
* @note None.
*/
static void c5gnbiot_log_app_buf ( void );
/**
* @brief 5G NB IoT response check.
* @details This function checks for response and returns the status of response.
*
* @return application status.
* See #err_t definition for detailed explanation.
* @note None.
*/
static err_t c5gnbiot_rsp_check ( void );
/**
* @brief 5G NB IoT chek connection.
* @details This function checks connection to the network and
* logs that status to UART.
*
* @note None.
*/
static void c5gnbiot_check_connection( void );
// ------------------------------------------------------ APPLICATION FUNCTIONS
void application_init ( void )
{
log_cfg_t log_cfg; /**< Logger config object. */
c5gnbiot_cfg_t c5gnbiot_cfg; /**< Click config object. */
/**
* 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 " );
Delay_ms( 1000 );
// Click initialization.
c5gnbiot_cfg_setup( &c5gnbiot_cfg );
C5GNBIOT_MAP_MIKROBUS( c5gnbiot_cfg, MIKROBUS_1 );
err_t init_flag = c5gnbiot_init( &c5gnbiot, &c5gnbiot_cfg );
if ( init_flag == UART_ERROR )
{
log_error( &logger, " Application Init Error. " );
log_info( &logger, " Please, run program again... " );
for ( ; ; );
}
log_info( &logger, " Power on device... " );
Delay_ms( 1000 );
c5gnbiot_power_on( &c5gnbiot );
// dummy read
c5gnbiot_process( );
c5gnbiot_clear_app_buf( );
// AT
c5gnbiot_send_cmd( &c5gnbiot, C5GNBIOT_CMD_AT );
app_error_flag = c5gnbiot_rsp_check( );
c5gnbiot_error_check( app_error_flag );
Delay_ms( 500 );
// ATI - product information
c5gnbiot_send_cmd( &c5gnbiot, C5GNBIOT_CMD_ATI );
app_error_flag = c5gnbiot_rsp_check( );
c5gnbiot_error_check( app_error_flag );
Delay_ms( 500 );
// CGMR - firmware version
c5gnbiot_send_cmd( &c5gnbiot, C5GNBIOT_CMD_CGMR );
app_error_flag = c5gnbiot_rsp_check( );
c5gnbiot_error_check( app_error_flag );
Delay_ms( 500 );
// COPS - deregister from network
c5gnbiot_send_cmd_with_parameter( &c5gnbiot, C5GNBIOT_CMD_COPS, "2" );
app_error_flag = c5gnbiot_rsp_check( );
c5gnbiot_error_check( app_error_flag );
Delay_ms( 500 );
// CGDCONT - set sim apn
c5gnbiot_set_sim_apn( &c5gnbiot, SIM_APN );
app_error_flag = c5gnbiot_rsp_check( );
c5gnbiot_error_check( app_error_flag );
Delay_ms( 500 );
// CFUN - full funtionality
c5gnbiot_send_cmd_with_parameter( &c5gnbiot, C5GNBIOT_CMD_CFUN, "1" );
app_error_flag = c5gnbiot_rsp_check( );
c5gnbiot_error_check( app_error_flag );
Delay_ms( 500 );
// COPS - automatic mode
c5gnbiot_send_cmd_with_parameter( &c5gnbiot, C5GNBIOT_CMD_COPS, "0" );
app_error_flag = c5gnbiot_rsp_check( );
c5gnbiot_error_check( app_error_flag );
Delay_ms( 2000 );
// CEREG - network registration status
c5gnbiot_send_cmd_with_parameter( &c5gnbiot, C5GNBIOT_CMD_CEREG, "2" );
app_error_flag = c5gnbiot_rsp_check( );
c5gnbiot_error_check( app_error_flag );
Delay_ms( 500 );
// CIMI - request IMSI
c5gnbiot_send_cmd( &c5gnbiot, C5GNBIOT_CMD_CIMI );
app_error_flag = c5gnbiot_rsp_check( );
c5gnbiot_error_check( app_error_flag );
Delay_ms( 500 );
app_buf_len = 0;
app_buf_cnt = 0;
app_connection_status = WAIT_FOR_CONNECTION;
log_info( &logger, " Application Task " );
Delay_ms( 5000 );
}
void application_task ( void )
{
if ( app_connection_status == WAIT_FOR_CONNECTION )
{
// CGATT - request IMSI
c5gnbiot_send_cmd_check( &c5gnbiot, C5GNBIOT_CMD_CGATT );
app_error_flag = c5gnbiot_rsp_check( );
c5gnbiot_error_check( app_error_flag );
Delay_ms( 500 );
// CEREG - network registration status
c5gnbiot_send_cmd_check( &c5gnbiot, C5GNBIOT_CMD_CEREG );
app_error_flag = c5gnbiot_rsp_check( );
c5gnbiot_error_check( app_error_flag );
Delay_ms( 500 );
// CSQ - signal quality
c5gnbiot_send_cmd( &c5gnbiot, C5GNBIOT_CMD_CESQ );
app_error_flag = c5gnbiot_rsp_check( );
c5gnbiot_error_check( app_error_flag );
Delay_ms( 5000 );
}
else
{
log_info( &logger, "CONNECTED TO NETWORK" );
for( ; ; )
{
log_printf( &logger, "> Sending message to phone number...\r\n" );
c5gnbiot_send_text_message( &c5gnbiot, SIM_SMSC, PHONE_NUMBER_TO_MESSAGE, MESSAGE_CONTENT );
app_error_flag = c5gnbiot_rsp_check( );
c5gnbiot_error_check( app_error_flag );
Delay_ms( 10000 );
Delay_ms( 10000 );
Delay_ms( 10000 );
}
}
}
void main ( void )
{
application_init( );
for ( ; ; )
{
application_task( );
}
}
static void c5gnbiot_clear_app_buf ( void )
{
memset( app_buf, 0, app_buf_len );
app_buf_len = 0;
app_buf_cnt = 0;
}
static err_t c5gnbiot_process ( void )
{
err_t return_flag = APP_ERROR_DRIVER;
int32_t rx_size;
char rx_buff[ PROCESS_BUFFER_SIZE ] = { 0 };
rx_size = c5gnbiot_generic_read( &c5gnbiot, rx_buff, PROCESS_BUFFER_SIZE );
if ( rx_size > 0 )
{
int32_t buf_cnt = 0;
return_flag = APP_OK;
if ( app_buf_len + rx_size >= PROCESS_BUFFER_SIZE )
{
c5gnbiot_clear_app_buf( );
return_flag = APP_ERROR_OVERFLOW;
}
else
{
buf_cnt = app_buf_len;
app_buf_len += rx_size;
}
for ( int32_t rx_cnt = 0; rx_cnt < rx_size; rx_cnt++ )
{
if ( rx_buff[ rx_cnt ] != 0 )
{
app_buf[ ( buf_cnt + rx_cnt ) ] = rx_buff[ rx_cnt ];
}
else
{
app_buf_len--;
buf_cnt--;
}
}
}
return return_flag;
}
static err_t c5gnbiot_rsp_check ( void )
{
uint16_t timeout_cnt = 0;
uint16_t timeout = 10000;
err_t error_flag = c5gnbiot_process( );
if ( ( error_flag != 0 ) && ( error_flag != -1 ) )
{
return error_flag;
}
while ( ( strstr( app_buf, RSP_OK ) == 0 ) && ( strstr( app_buf, RSP_ERROR ) == 0 ) )
{
error_flag = c5gnbiot_process( );
if ( ( error_flag != 0 ) && ( error_flag != -1 ) )
{
return error_flag;
}
timeout_cnt++;
if ( timeout_cnt > timeout )
{
while ( ( strstr( app_buf, RSP_OK ) == 0 ) && ( strstr( app_buf, RSP_ERROR ) == 0 ) )
{
c5gnbiot_send_cmd( &c5gnbiot, C5GNBIOT_CMD_AT );
c5gnbiot_process( );
Delay_ms( 100 );
}
c5gnbiot_clear_app_buf( );
return APP_ERROR_TIMEOUT;
}
Delay_ms( 1 );
}
c5gnbiot_check_connection();
c5gnbiot_log_app_buf();
log_printf( &logger, "-----------------------------------\r\n" );
return APP_OK;
}
static void c5gnbiot_error_check( err_t error_flag )
{
if ( ( error_flag != 0 ) && ( error_flag != -1 ) )
{
switch ( error_flag )
{
case -2:
log_error( &logger, " Overflow!" );
break;
case -3:
log_error( &logger, " Timeout!" );
break;
default:
break;
}
}
}
static void c5gnbiot_log_app_buf ( void )
{
for ( int32_t buf_cnt = 0; buf_cnt < app_buf_len; buf_cnt++ )
{
log_printf( &logger, "%c", app_buf[ buf_cnt ] );
}
log_printf( &logger, "\r\n" );
c5gnbiot_clear_app_buf( );
}
static void c5gnbiot_check_connection( void )
{
#define CONNECTED "+CGATT: 1"
if ( strstr( app_buf, CONNECTED ) != 0 )
{
app_connection_status = CONNECTED_TO_NETWORK;
}
}
// ------------------------------------------------------------------------ END