在充满活力的亚太地区,我们的目标是提供一套全面的解决方案,满足该地区的需求,借助嵌入式TCP/UDP栈和IPv4/IPv6双栈支持,实现无缝通信和网络连接。
A
A
硬件概览
它是如何工作的?
4G LTE-APJ Click基于Trasna的LARA-R280系列调制解调器。多个Click板™覆盖不同地区,使用不同模块:北美 - Verizon(LARA-R204),北美 - AT&T(LARA-R202),亚太地区(LARA-R280),欧洲(LARA-R211)。这些模块的主要区别在于支持的频段,这些频段符合各地区的规定。每个模块支持的频段和其他相关信息可以在LARA-R2系列调制解调器的数据表中找到。LARA-R2系列调制解调器是Click板™的主要组件,由多个内部模块或部分组成,如天线切换和信号调理部分、RF收发器部分、存储器、电源管理,最重要的是蜂窝基带处理器。该部分包含管理其他部分所需的逻辑,并提供与主控MCU的接口。该接口包括报告天线状态、SIM卡状态、UART接口线、复位线、USB接口线等的多条线路。这些线路被路由到Click板™的相应元素。LARA-R2系列模块必须由干净稳定的电源供电。模块正常工作所需的电压约为4V,通过Microchip的MCP1826(一款1A低压降输出(LDO)稳压器)从5V mikroBUS™轨获取。尽管LARA-R2系列模块是低功耗设备,但蜂窝网络模块通常因其高
功耗而闻名,因此必须使用1A LDO。LARA-R2系列的数字部分内部由1.8V供电,因此需要调节连接主控MCU和模块的通信总线线。为此,使用了另一个小型LDO,为德州仪器的TXB0106(一款6位双向电平转换和电压转换器,带自动方向感应)的一侧提供所需的参考电压。电平转换器另一侧的参考电压取自板载SMD跳线,标记为PWR SEL。该跳线在mikroBUS™的3.3V和5V之间选择,具体取决于使用的MCU类型及其逻辑电压电平要求。LARA-R2系列模块的UART总线连接到电平转换器的一侧,而另一侧(转换后的)连接到相应的mikroBUS™ UART引脚。LARA-R2系列模块设计为传统的DCE设备(数据通信设备),提供完整的UART引脚数,包括硬件流控制引脚(CTS,RTS)。这些引脚被路由到mikroBUS™ CS(RTS)和INT引脚(CTS),如果需要硬件流控制,可以在MCU软件中使用。RI引脚是路由到mikroBUS™ PWM引脚的响铃指示器。另一组调制解调器控制引脚通过电平转换器路由到mikroBUS™引脚:RI是响铃指示引脚,路由到mikroBUS™ PWM引脚。该引脚指示来
电。STAT引脚用于信号网络连接状态。该引脚通过电平转换器路由到mikroBUS™ AN引脚,并通过黄色LED直观地指示网络连接状态。传输状态由STAT LED旁边的红色TX LED指示。PWRKEY引脚路由到mikroBUS™ RST引脚,用于上电序列。在该引脚上施加低脉冲,如果提供有效的电源电压,设备将上电。为了正确地从网络分离并将工作参数存储在其非易失性存储器中,应在断开电源之前通过发出AT+CPWROFF命令安全地关闭模块。LTE蜂窝网络中使用的E-UTRA物理无线电层的一个独特功能是空间复用天线技术,它允许使用多个天线以更好地接收特定频段。除了主要的TX/RX天线外,此Click还使用了一个次要的分集RX天线,以便更好地接收信号。4G LTE Click配备了一个Micro USB连接器。它允许模块通过个人电脑(PC)供电和配置。Trasna公司提供了一个软件套件,可用于配置LARA-R2系列模块。Click板™背面的Micro SIM卡座用于安装SIM卡。此设备在没有有效SIM卡的情况下无法使用,SIM卡允许连接到蜂窝网络。支持1.8V和3V SIM卡。
功能概述
开发板
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 开发板转化为完整、实用且外观精美的定制系统。
微控制器概述
MCU卡片 / MCU

建筑
ARM Cortex-M4
MCU 内存 (KB)
256
硅供应商
STMicroelectronics
引脚数
100
RAM (字节)
40960
你完善了我!
配件
LTE Flat Rotation Antenna是一款多功能的选择,可以提升3G/4G LTE设备的性能。其宽频率范围为700-2700MHz,确保在全球主要蜂窝频段上的最佳连接。这款扁平天线配有SMA公头连接器,便于直接连接到设备或SMA模块连接器。其一个突出特点是可调角度,能够以45⁰增量设置(0⁰/45⁰/90⁰),使您能够微调天线的方向以获得最佳信号接收。其阻抗为50Ω,VSW比小于2.0:1,确保可靠且高效的连接。天线具有5dB增益、垂直极化和全向辐射模式,增强了信号强度,适用于各种应用。天线长196mm,宽38mm,提供紧凑而有效的连接解决方案。其最大输入功率为50W,可以满足各种设备的需求。
使用的MCU引脚
mikroBUS™映射器
“仔细看看!”
Click board™ 原理图

一步一步来
项目组装
软件支持
库描述
该库包含用于4G LTE APJ Click驱动程序的API。
关键功能:
c4gltee_module_power_on- 此功能为模块供电c4gltee_send_cmd_with_parameter- 此功能向Click模块发送带有指定参数的命令c4gltee_send_cmd_parameter_check- 此功能检查已发送的命令
开源
代码示例
完整的应用程序代码和一个现成的项目可以通过NECTO Studio包管理器直接安装到NECTO Studio。 应用程序代码也可以在MIKROE的GitHub账户中找到。
/*!
* @file main.c
* @brief 4G LTE-APJ Click Example.
*
* # Description
* This example reads and processes data from 4G LTE-APJ Click.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initializes the driver and powers up the module, then sets default configuration
* for connecting the device to network.
*
* ## Application Task
* Waits for device to connect to network and then sends a desired SMS to the selected phone number
* approximately every 30 seconds.
*
* ## Additional Function
* - static void c4glteapj_clear_app_buf ( void )
* - static void c4glteapj_error_check( err_t error_flag )
* - static void c4glteapj_log_app_buf ( void )
* - static void c4glteapj_check_connection( void )
* - static err_t c4glteapj_rsp_check ( void )
* - static err_t c4glteapj_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 (required for PDU mode only) 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 Stefan Ilic
*
*/
#include "board.h"
#include "log.h"
#include "c4glteapj.h"
#include "string.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 - only in PDU mode
#define PHONE_NUMBER_TO_MESSAGE "" // Set Phone number to message
#define MESSAGE_CONTENT "4G LTE-APJ Click board - demo example." // Message content
#define PROCESS_BUFFER_SIZE 256
#define WAIT_FOR_CONNECTION 0
#define CONNECTED_TO_NETWORK 1
static c4glteapj_t c4glteapj;
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 4G LTE-APJ clearing application buffer.
* @details This function clears memory of application buffer and reset it's length and counter.
* @note None.
*/
static void c4glteapj_clear_app_buf ( void );
/**
* @brief 4G LTE-APJ data reading function.
* @details This function reads data from device and concatenates 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 c4glteapj_process ( void );
/**
* @brief 4G LTE-APJ check for errors.
* @details This function checks for different types of errors and logs them on UART.
* @note None.
*/
static void c4glteapj_error_check( err_t error_flag );
/**
* @brief 4G LTE-APJ logs application buffer.
* @details This function logs data from application buffer.
* @note None.
*/
static void c4glteapj_log_app_buf ( void );
/**
* @brief 4G LTE-APJ 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 c4glteapj_rsp_check ( void );
/**
* @brief 4G LTE-APJ check connection.
* @details This function checks connection to the network and
* logs that status to UART.
*
* @note None.
*/
static void c4glteapj_check_connection( void );
void application_init ( void ) {
log_cfg_t log_cfg; /**< Logger config object. */
c4glteapj_cfg_t c4glteapj_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 " );
// Click initialization.
c4glteapj_cfg_setup( &c4glteapj_cfg );
C4GLTEAPJ_MAP_MIKROBUS( c4glteapj_cfg, MIKROBUS_1 );
c4glteapj_init( &c4glteapj, &c4glteapj_cfg );
c4glteapj_module_power_on( &c4glteapj );
// dummy read
c4glteapj_process( );
c4glteapj_clear_app_buf( );
// AT
c4glteapj_send_cmd( &c4glteapj, C4GLTEAPJ_CMD_AT );
app_error_flag = c4glteapj_rsp_check( );
c4glteapj_error_check( app_error_flag );
Delay_ms ( 500 );
// ATI - product information
c4glteapj_send_cmd( &c4glteapj, C4GLTEAPJ_CMD_ATI );
app_error_flag = c4glteapj_rsp_check( );
c4glteapj_error_check( app_error_flag );
Delay_ms ( 500 );
// CGMR - firmware version
c4glteapj_send_cmd( &c4glteapj, C4GLTEAPJ_CMD_CGMR );
app_error_flag = c4glteapj_rsp_check( );
c4glteapj_error_check( app_error_flag );
Delay_ms ( 500 );
// CMEE - Report Mobile Equipment Error
c4glteapj_send_cmd_with_parameter( &c4glteapj, C4GLTEAPJ_CMD_CMEE, "2" );
app_error_flag = c4glteapj_rsp_check( );
c4glteapj_error_check( app_error_flag );
Delay_ms ( 500 );
// COPS - deregister from network
c4glteapj_send_cmd_with_parameter( &c4glteapj, C4GLTEAPJ_CMD_COPS, "2" );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
app_error_flag = c4glteapj_rsp_check( );
c4glteapj_error_check( app_error_flag );
Delay_ms ( 500 );
// CGDCONT - set sim apn
c4glteapj_set_sim_apn( &c4glteapj, SIM_APN );
app_error_flag = c4glteapj_rsp_check( );
c4glteapj_error_check( app_error_flag );
Delay_ms ( 500 );
// CFUN - full funtionality
c4glteapj_send_cmd_with_parameter( &c4glteapj, C4GLTEAPJ_CMD_CFUN, "1" );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
app_error_flag = c4glteapj_rsp_check( );
c4glteapj_error_check( app_error_flag );
Delay_ms ( 500 );
// COPS - automatic mode
c4glteapj_send_cmd_with_parameter( &c4glteapj, C4GLTEAPJ_CMD_COPS, "0" );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
app_error_flag = c4glteapj_rsp_check( );
c4glteapj_error_check( app_error_flag );
Delay_ms ( 500 );
// CREG - network registration status
c4glteapj_send_cmd_with_parameter( &c4glteapj, C4GLTEAPJ_CMD_CREG, "1" );
app_error_flag = c4glteapj_rsp_check( );
c4glteapj_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 ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
}
void application_task ( void ) {
if ( app_connection_status == WAIT_FOR_CONNECTION ) {
// CREG - network registration status
c4glteapj_send_cmd_check( &c4glteapj, C4GLTEAPJ_CMD_CREG );
app_error_flag = c4glteapj_rsp_check( );
c4glteapj_error_check( app_error_flag );
Delay_ms ( 500 );
// CSQ - signal quality
c4glteapj_send_cmd( &c4glteapj, C4GLTEAPJ_CMD_CSQ );
app_error_flag = c4glteapj_rsp_check( );
c4glteapj_error_check( app_error_flag );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
} else {
log_info( &logger, "CONNECTED TO NETWORK" );
// SMS message format - PDU mode
c4glteapj_send_cmd_with_parameter( &c4glteapj, C4GLTEAPJ_CMD_CMGF, "0" );
app_error_flag = c4glteapj_rsp_check( );
c4glteapj_error_check( app_error_flag );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
for( ; ; ) {
log_printf( &logger, "> Sending message to phone number...\r\n" );
c4glteapj_send_sms_pdu ( &c4glteapj, SIM_SMSC, PHONE_NUMBER_TO_MESSAGE, MESSAGE_CONTENT );
app_error_flag = c4glteapj_rsp_check( );
c4glteapj_error_check( app_error_flag );
// 30 seconds delay
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
}
}
}
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;
}
static void c4glteapj_clear_app_buf ( void ) {
memset( app_buf, 0, app_buf_len );
app_buf_len = 0;
app_buf_cnt = 0;
}
static err_t c4glteapj_process ( void ) {
err_t return_flag = APP_ERROR_DRIVER;
int32_t rx_size;
char rx_buff[ PROCESS_BUFFER_SIZE ] = { 0 };
rx_size = c4glteapj_generic_read( &c4glteapj, 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 ) {
c4glteapj_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 c4glteapj_rsp_check ( void ) {
uint16_t timeout_cnt = 0;
uint32_t timeout = 100000;
err_t error_flag = c4glteapj_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 = c4glteapj_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 ) ) {
c4glteapj_send_cmd( &c4glteapj, C4GLTEAPJ_CMD_AT );
c4glteapj_process( );
Delay_ms ( 100 );
}
c4glteapj_clear_app_buf( );
return APP_ERROR_TIMEOUT;
}
Delay_ms ( 1 );
}
c4glteapj_check_connection();
c4glteapj_log_app_buf();
return APP_OK;
}
static void c4glteapj_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 c4glteapj_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-----------------------------------\r\n" );
c4glteapj_clear_app_buf( );
}
static void c4glteapj_check_connection( void ) {
#define CONNECTED "+CREG: 1,1"
if ( strstr( app_buf, CONNECTED ) != 0 ) {
app_connection_status = CONNECTED_TO_NETWORK;
}
}
// ------------------------------------------------------------------------ END
额外支持
资源
类别:GSM/LTE

































