中级
30 分钟

体验SARA-R410M-02B和STM32L073RZ在物联网连接方面的巨大进步

物联网连接的未来

LTE IoT Click with Nucleo-64 with STM32L073RZ MCU

已发布 6月 24, 2024

点击板

LTE IoT Click

开发板

Nucleo-64 with STM32L073RZ MCU

编译器

NECTO Studio

微控制器单元

STM32L073RZ

通过 LTE IoT 赋能您的物联网项目,无缝集成 CAT M1 和 NB1 技术,开启无限连接的可能性。

A

A

硬件概览

它是如何工作的?

LTE IoT Click 基于 u-Blox 的 SARA-R410M-02B,这是一个可配置的 LTE Cat M1/NB1 多模模块,具有全球物联网和 M2M 应用支持。该模块由多个内部块或部分组成,例如 RF 和内存部分、电源管理部分以及具有外围接口的蜂窝基带处理器。它支持 UART 和 USB 接口,以及外部 SIM 卡/芯片接口,具有超低功耗和成本优化的解决方案,非常适合开发 LPWA 物联网应用。它还提供扩展的不连续接收(e-DRX),将电池寿命延长至 10 年。SARA-R410M-02B 的另一个优点是硬件已准备好在未来支持通过 Cat M1 的 VoLTE 实现语音功能,可用于需要一定人机交互的应用,例如安全应用中的报警面板。SARA-R410M-02B 模块的电源由 Microchip 的 1A 低压差输出(LDO)稳压器 MCP1826 调节至 3.8V。模块的数字接口供电输出引脚为 Texas Instruments 的 6 位双向电平转换和电压转换器 TXB0106 的一侧提供所需的参考电压。模块的主 UART 总线连接到 TXB0106 电平转换器的一侧,而另一侧连接到相应的 mikroBUS™ UART 引脚。电

平转换器另一侧的参考电压取自板载 SMD 跳线,标记为 PWR SEL,用于在 3.3V 和 5V 之间选择 mikroBUS™,取决于所用 MCU 类型及其逻辑电压水平要求。SARA-R410M-02B 模块使用 UART 接口与 MCU 通信,常用的 UART RX 和 TX 引脚,包括硬件流控制引脚 UART CTS、RTS、RI(清除发送、准备发送和响铃指示器)。它支持自动波特率检测,默认配置为 115200 bps,用于数据传输和与主 MCU 交换 AT 通信命令。除了默认波特率外,UART 接口还支持 9600、19200、38400 和 57600 波特率。该接口还可以作为设备连接到 USB 主机,例如个人计算机(PC),允许使用 u-Blox 提供的专有应用程序 m-center,提供干净且全面的接口,用于访问模块的主要功能、设置配置参数、管理 SMS 消息、跟踪模块活动等。LTE IoT Click 具有 50Ω 阻抗的 SMA 天线连接器,可以用于连接 MikroE 提供的合适天线,例如橡胶天线 GSM/GPRS 直角。这款天线非常适合所有 GSM/GPRS 应用,支持一系列频率和频段。Click board™ 背面有一个 Micro

 SIM 卡插槽,用于安装 micro SIM 卡,允许连接到蜂窝网络,支持 1.8V 和 3V SIM 卡类型。板载低电平有效的按钮标记为 PWR,连接到 mikroBUS™ 的 AN 引脚,代表点火(开机)按钮,其成功操作将由 STAT LED 指示。如果设备已启动,该引脚上持续 1.5 秒的低脉冲将关闭模块。也可以通过发出 AT+CPWROFF 命令或使用连接到 mikroBUS™ RST 引脚的复位功能关闭模块,这将通过在该引脚上发送持续 10 秒的有效低输入导致突然断电(强制断电)。此 Click board™ 具有两个 LED 指示灯:黄色 LED 标记为 STAT,用于直观指示设备的操作状态,红色 LED 标记为 TX,用于指示网络状态。此 Click Board™ 设计用于使用 3.3V 和 5V 逻辑电压水平,可通过 PWR SEL 跳线选择。适当的电压电平转换器执行正确的逻辑电压电平转换,而 LDO 确保模块由推荐值供电。这样,3.3V 和 5V 兼容的 MCU 都可以正确使用通信线路。此外,此 Click board™ 配备了一个库,包含易于使用的函数和示例代码,可用于进一步开发。

LTE IoT Click hardware overview image

功能概述

开发板

Nucleo-64搭载STM32L073RZ MCU提供了一个经济实惠且灵活的平台,供开发人员探索新的想法并原型化其设计。该板利用了STM32微控制器的多功能性,使用户能够为其项目选择性能和功耗之间的最佳平衡。它采用LQFP64封装的STM32微控制器,并包括一些必要的组件,例如用户LED,可以同时作为ARDUINO®信号使用,以及用户和复位按钮,以及用于精准定时操作的32.768kHz晶体振荡器。设计时考虑了扩展性和灵活性,Nucleo-64板具有ARDUINO® 

Uno V3扩展连接器和ST morpho扩展引脚标头,为全面项目集成提供了对STM32 I/O的完全访问权限。电源选项具有适应性,支持ST-LINK USB VBUS或外部电源,确保在各种开发环境中的适应性。该板还配备了一个内置的ST-LINK调试器/编程器,具有USB重新枚举功能,简化了编程和调试过程。此外,该板还设计了外部SMPS,以实现有效的Vcore逻辑供电,支持USB设备全速或USB SNK/UFP全速,以及内置的加密功能,增强了项目的功耗效率和安全性。通过专用

连接器提供了额外的连接性,用于外部SMPS实验、ST-LINK的USB连接器和MIPI®调试连接器,扩展了硬件接口和实验的可能性。开发人员将通过STM32Cube MCU软件包中全面的免费软件库和示例得到广泛的支持。这与与各种集成开发环境(IDE)的兼容性相结合,包括IAR Embedded Workbench®、MDK-ARM和STM32CubeIDE,确保了平稳高效的开发体验,使用户能够充分发挥Nucleo-64板在其项目中的功能。

Nucleo 64 with STM32L073RZ MCU double side image

微控制器概述 

MCU卡片 / MCU

default

建筑

ARM Cortex-M0

MCU 内存 (KB)

192

硅供应商

STMicroelectronics

引脚数

64

RAM (字节)

20480

你完善了我!

配件

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™。

Click Shield for Nucleo-64 accessories 1 image

LTE 平面旋转天线是一种多功能选择,可提升 3G/4G LTE 设备的性能。其宽频率范围为 700-2700MHz,确保在全球主要蜂窝频段上的最佳连接。此平板天线配有 SMA 公连接器,可轻松直接连接到您的设备或 SMA 模块连接器。其一大亮点是可调节角度,可按 45⁰ 的增量(0⁰/45⁰/90⁰)设置,使您能够微调天线方向以实现最大信号接收。具有 50Ω 的阻抗和 <2.0:1 的电压驻波比(VSWR),这款天线可确保可靠高效的连接。其 5dB 的增益、垂直极化和全向辐射模式增强了信号强度,适用于各种应用。天线尺寸为 196mm 长和 38mm 宽,提供紧凑而有效的解决方案以改善连接。其最大输入功率为 50W,能够满足各种设备的需求。

LTE IoT Click accessories image

使用的MCU引脚

mikroBUS™映射器

Power ON
PC0
AN
HW Reset / Power OFF
PC12
RST
UART CTS
PB12
CS
NC
NC
SCK
NC
NC
MISO
NC
NC
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
UART RI
PC8
PWM
UART RTS
PC14
INT
UART TX
PA2
TX
UART RX
PA3
RX
NC
NC
SCL
NC
NC
SDA
Power Supply
5V
5V
Ground
GND
GND
1

“仔细看看!”

Click board™ 原理图

LTE IoT Click Schematic schematic

一步一步来

项目组装

Click Shield for Nucleo-64 accessories 1 image hardware assembly

从选择您的开发板和Click板™开始。以Nucleo-64 with STM32L073RZ MCU作为您的开发板开始。

Click Shield for Nucleo-64 accessories 1 image hardware assembly
Nucleo 64 with STM32F401RE MCU front image hardware assembly
LTE IoT 5 Click front image hardware assembly
Prog-cut hardware assembly
LTE IoT 5 Click complete accessories setup image hardware assembly
Board mapper by product8 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
Clicker 4 for STM32F4 HA MCU Step hardware assembly
Necto No Display image step 8 hardware assembly
Necto image step 9 hardware assembly
Necto image step 10 hardware assembly
Debug Image Necto Step 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”替换为要显示的参数。

软件支持

库描述

此库包含 LTE IoT Click 驱动程序的 API。

关键功能:

  • lteiot_power_on - LTE IoT 模块电源开启

  • lteiot_send_cmd - 发送命令功能

开源

代码示例

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

/*!
 * \file 
 * \brief LteIot Click example
 * 
 * # Description
 * This example reads and processes data from LTE 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 SMS to selected phone number.
 * 
 * ## Additional Function
 * - static void lteiot_clear_app_buf ( void )
 * - static void lteiot_error_check( err_t error_flag )
 * - static void lteiot_log_app_buf ( void )
 * - static void lteiot_check_connection( void )
 * - static err_t lteiot_rsp_check ( void )
 * - static err_t lteiot_process ( void )
 * 
 * @note 
 * In order for the example to work, 
 * user needs to set the phone number and sim apn to which he wants to send an SMS
 * Enter valid data for the following macros: SIM_APN and PHONE_NUMBER_TO_MESSAGE.
 * E.g. 
    SIM_APN "vipmobile"
    PHONE_NUMBER_TO_MESSAGE "999999999"
 * 
 * @author MikroE Team
 *
 */
// ------------------------------------------------------------------- INCLUDES

#include "board.h"
#include "log.h"
#include "lteiot.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 PHONE_NUMBER_TO_MESSAGE             ""  // Set Phone number to message
#define MESSAGE_CONTENT                     "LTE IoT Click"   // Messege content 

#define PROCESS_BUFFER_SIZE                 500

#define WAIT_FOR_CONNECTION                 0
#define CONNECTED_TO_NETWORK                1

static lteiot_t lteiot;
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 LTE IoT clearing application buffer.
 * @details This function clears memory of application buffer and reset its length and counter.
 * @note None.
 */
static void lteiot_clear_app_buf ( void );

/**
 * @brief LTE 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 lteiot_process ( void );

/**
 * @brief LTE IoT check for errors.
 * @details This function checks for different types of errors and logs them on UART.
 * @note None.
 */
static void lteiot_error_check( err_t error_flag );

/**
 * @brief LTE IoT logs application buffer.
 * @details This function logs data from application buffer.
 * @note None.
 */
static void lteiot_log_app_buf ( void );

/**
 * @brief LTE 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 lteiot_rsp_check ( void );

/**
 * @brief LTE IoT chek connection.
 * @details This function checks connection to the network and 
 *          logs that status to UART.
 * 
 * @note None.
 */
static void lteiot_check_connection( void );

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

void application_init ( void )
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    lteiot_cfg_t lteiot_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.
    lteiot_cfg_setup( &lteiot_cfg );
    LTEIOT_MAP_MIKROBUS( lteiot_cfg, MIKROBUS_1 );
    err_t init_flag  = lteiot_init( &lteiot, &lteiot_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... " );
    lteiot_power_on( &lteiot );
    
    // dummy read
    lteiot_process( );
    lteiot_clear_app_buf( );
    
    // AT
    lteiot_send_cmd( &lteiot, LTEIOT_CMD_AT );
    app_error_flag = lteiot_rsp_check( );
    lteiot_error_check( app_error_flag );
    Delay_ms ( 500 );
    
    // ATI - product information
    lteiot_send_cmd( &lteiot, LTEIOT_CMD_ATI );
    app_error_flag = lteiot_rsp_check(  );
    lteiot_error_check( app_error_flag );
    Delay_ms ( 500 );
    
    // CGMR - firmware version
    lteiot_send_cmd( &lteiot, LTEIOT_CMD_CGMR );
    app_error_flag = lteiot_rsp_check(  );
    lteiot_error_check( app_error_flag );
    Delay_ms ( 500 );
    
    // COPS - deregister from network
    lteiot_send_cmd_with_parameter( &lteiot, LTEIOT_CMD_COPS, "2" );
    app_error_flag = lteiot_rsp_check(  );
    lteiot_error_check( app_error_flag );
    Delay_ms ( 500 );
    
    // CGDCONT - set sim apn
    lteiot_set_sim_apn( &lteiot, SIM_APN );
    app_error_flag = lteiot_rsp_check(  );
    lteiot_error_check( app_error_flag );
    Delay_ms ( 500 );
     
    // CFUN - full funtionality
    lteiot_send_cmd_with_parameter( &lteiot, LTEIOT_CMD_CFUN, "1" );
    app_error_flag = lteiot_rsp_check(  );
    lteiot_error_check( app_error_flag );
    Delay_ms ( 500 );
    
    // COPS - automatic mode
    lteiot_send_cmd_with_parameter( &lteiot, LTEIOT_CMD_COPS, "0" );
    app_error_flag = lteiot_rsp_check(  );
    lteiot_error_check( app_error_flag );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    
    // CEREG - network registration status
    lteiot_send_cmd_with_parameter( &lteiot, LTEIOT_CMD_CEREG, "2" );
    app_error_flag = lteiot_rsp_check(  );
    lteiot_error_check( app_error_flag );
    Delay_ms ( 500 );
    
    // CIMI - request IMSI
    lteiot_send_cmd( &lteiot, LTEIOT_CMD_CIMI );
    app_error_flag = lteiot_rsp_check(  );
    lteiot_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 )
    {
        // CGATT - request IMSI
        lteiot_send_cmd_check( &lteiot, LTEIOT_CMD_CGATT );
        app_error_flag = lteiot_rsp_check(  );
        lteiot_error_check( app_error_flag );
        Delay_ms ( 500 );
        
        // CEREG - network registration status
        lteiot_send_cmd_check( &lteiot, LTEIOT_CMD_CEREG );
        app_error_flag = lteiot_rsp_check(  );
        lteiot_error_check( app_error_flag );
        Delay_ms ( 500 );
        
        // CSQ - signal quality
        lteiot_send_cmd( &lteiot, LTEIOT_CMD_CSQ );
        app_error_flag = lteiot_rsp_check(  );
        lteiot_error_check( app_error_flag );
        Delay_ms ( 1000 );
        Delay_ms ( 1000 );
        Delay_ms ( 1000 );
        Delay_ms ( 1000 );
        Delay_ms ( 1000 );
    }
    else
    {
        log_info( &logger, "CONNECTED TO NETWORK" );
        
        // SMS message format - text mode
        lteiot_send_cmd_with_parameter( &lteiot, "AT+CMGF", "1" );
        app_error_flag = lteiot_rsp_check(  );
        lteiot_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" );
            lteiot_send_text_message( &lteiot, PHONE_NUMBER_TO_MESSAGE, MESSAGE_CONTENT );
            app_error_flag = lteiot_rsp_check(  );
            lteiot_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 lteiot_clear_app_buf ( void )
{
    memset( app_buf, 0, app_buf_len );
    app_buf_len = 0;
    app_buf_cnt = 0;
}

static err_t lteiot_process ( void )
{
    err_t return_flag = APP_ERROR_DRIVER;
    int32_t rx_size;
    char rx_buff[ PROCESS_BUFFER_SIZE ] = { 0 };
    
    rx_size = lteiot_generic_read( &lteiot, 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 )
        {
            lteiot_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 lteiot_rsp_check ( void )
{
    uint16_t timeout_cnt = 0;
    uint16_t timeout = 10000;
    
    err_t error_flag = lteiot_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 = lteiot_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 ) )
            {
                lteiot_send_cmd( &lteiot, LTEIOT_CMD_AT );
                lteiot_process(  );
                Delay_ms ( 100 );
            }
            lteiot_clear_app_buf(  );
            return APP_ERROR_TIMEOUT;
        }
        
        Delay_ms ( 1 );
    }
    
    lteiot_check_connection();
    
    lteiot_log_app_buf();
    
    log_printf( &logger, "-----------------------------------\r\n" );
    
    return APP_OK;
}

static void lteiot_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 lteiot_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" );
    lteiot_clear_app_buf(  );
}

static void lteiot_check_connection( void )
{
    #define CONNECTED "+CGATT: 1"
    
    if ( strstr( app_buf, CONNECTED ) != 0 )
    {
        app_connection_status = CONNECTED_TO_NETWORK;
    }
}

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

额外支持

资源

喜欢这个项目吗?

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