通过一个将 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 年的电池寿命,用户完全可以单独使用它,只需电池供电。
功能概述
开发板
Fusion for TIVA v8 是一款专为快速开发嵌入式应用的需求而特别设计的开发板。它支持广泛的微控制器,如不同的32位ARM® Cortex®-M基础MCUs,来自Texas Instruments,无论它们的引脚数量如何,并且具有一系列独特功能,例如首次通过WiFi网络实现的嵌入式调试器/程序员。开发板布局合理,设计周到,使得最终用户可以在一个地方找到所有必要的元素,如开关、按钮、指示灯、连接器等。得益于创新的制造技术,Fusion for TIVA v8 提供了流畅而沉浸式的工作体验,允许在任何情况下、任何地方、任何
时候都能访问。Fusion for TIVA v8开发板的每个部分都包含了使同一板块运行最高效的必要组件。一个先进的集成CODEGRIP程序/调试模块提供许多有价值的编程/调试选项,包括对JTAG、SWD和SWO Trace(单线输出)的支持,并与Mikroe软件环境无缝集成。此外,它还包括一个干净且调节过的开发板电源供应模块。它可以使用广泛的外部电源,包括电池、外部12V电源供应和通过USB Type-C(USB-C)连接器的电源。通信选项如USB-UART、USB HOST/DEVICE、CAN(如果MCU卡支持的话)和以
太网也包括在内。此外,它还拥有广受好评的 mikroBUS™标准,为MCU卡提供了标准化插座(SiBRAIN标准),以及两种显示选项,用于TFT板线产品和基于字符的LCD。Fusion for TIVA v8 是Mikroe快速开发生态系统的一个组成部分。它由Mikroe软件工具原生支持,得益于大量不同的Click板™(超过一千块板),其数量每天都在增长,它涵盖了原型制作和开发的许多方面。
微控制器概述
MCU卡片 / MCU

类型
8th Generation
建筑
ARM Cortex-M4
MCU 内存 (KB)
512
硅供应商
Texas Instruments
引脚数
128
RAM (字节)
262144
你完善了我!
配件
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