初学者
10 分钟

使用Calypso (2610011025000)和STM32F103RB为您的嵌入式应用提供可靠和安全的无线连接

Calypso WLAN模块,符合IEEE 802.11 b/g/n标准,用于无线网络通信

Calypso Click with Nucleo 64 with STM32F103RB MCU

已发布 10月 08, 2024

点击板

Calypso Click

开发板

Nucleo 64 with STM32F103RB MCU

编译器

NECTO Studio

微控制器单元

STM32F103RB

非常适合需要长期低功耗电池运行的云连接系统

A

A

硬件概览

它是如何工作的?

Calypso Click基于Würth Elektronik的WIRL-WIFS Calypso(2610011025000)WLAN模块,专为嵌入式应用中的无线连接设计。该模块符合IEEE 802.11 b/g/n标准,配备完整集成的TCP/IP协议栈,是WiFi通信的多功能解决方案。Calypso模块通过WiFi认证(ID: WFA81685),确保符合行业标准,提供可靠的应用性能。它采用边缘电镀连接和智能天线配置,易于集成到任何系统中,并具有直观的AT风格命令界面,简化了配置和控制。Calypso模块支持IPv4和IPv6协议,并预装了多种网络协议,如SNTP、DHCPv4、DHCPv6、mDNS、HTTP(S)和MQTT,确保高效、安全的数据交换。其先进的安全功能包括同时处理多达六个安全套接字、支持安全启动、存储和空中(OTA)更新,使其成为需要安全、可靠云连接的物联网应用的理想选择。Calypso模块具备低功耗无线连接,适用于串行电缆替代方案或中等数据吞吐量需求的低功耗物联网设备。该Click板™采用

UART接口与主MCU通信,使用标准的RX和TX引脚,并通过CTS和RTS引脚进行硬件流控制。默认通信速率为921600bps,确保平稳、高效的数据传输。整个模块通过UART接口的AT命令进行配置和控制,配置完成后独立管理WLAN连接,释放主控制器的资源。此外,通过定制固件开发,可实现无需主机的独立应用。Click板™配备USB Type-C连接器,通过PC进行供电和配置。这得益于集成的CP2102N USB到UART桥接芯片和NCP1117 LDO稳压器,它将USB供电转换为模块所需的3.3V。除了这种供电方式,板载还支持背面的纽扣电池备用电源,允许实现前面提到的独立运行。除了UART接口外,该Click板™还使用I2C接口控制I/O扩展器PCA9536,由于mikroBUS™引脚数量有限,该扩展器管理特定模块功能。通过扩展器,可以控制以下功能:AP0和AP1,用于设置应用模式(如AT命令正常模式、OTA、Provisioning或透明模式);BOOT引脚在启动时拉低以启用标准应

用引导;RM2引脚可配置为远程GPIO功能,允许配置和控制GPIO,包括输入、输出和PWM。此外,这些信号可以通过SW1开关手动控制,RM1则通过开关管理,RM0可以通过mikroBUS™插座进行控制。该板还配备了多个额外功能来增强其性能。它包括一个复位引脚(RST)和一个RESET按钮用于模块复位,以及一个唤醒引脚(WUP)用于将模块从睡眠模式中唤醒。板上有两个LED指示灯用于提供视觉反馈:一个绿色(LD2)和一个蓝色(LD3),用于指示模块的操作状态。此外,用户可以选择板载PCB天线(适用于紧凑设计)或通过板载ANT u.Fl连接器连接外部天线,适用于远程应用。此Click板™只能在3.3V逻辑电平下运行。在使用具有不同逻辑电平的MCU之前,必须进行适当的逻辑电平转换。此外,该Click板™还配备了包含易于使用的函数和示例代码的库,可作为进一步开发的参考。

Calypso Click hardware overview image

功能概述

开发板

Nucleo-64 搭载 STM32F103RB 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 板在他们的项目中的能力。

Nucleo 64 with STM32F103RB MCU double side image

微控制器概述 

MCU卡片 / MCU

default

建筑

ARM Cortex-M3

MCU 内存 (KB)

128

硅供应商

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

使用的MCU引脚

mikroBUS™映射器

General-Purpose I/O 0
PC0
AN
Reset / ID SEL
PC12
RST
UART CTS / ID COMM
PB12
CS
NC
NC
SCK
NC
NC
MISO
NC
NC
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
Module Wake-Up
PC8
PWM
UART RTS
PC14
INT
UART TX
PA2
TX
UART RX
PA3
RX
I2C Clock
PB8
SCL
I2C Data
PB9
SDA
NC
NC
5V
Ground
GND
GND
1

“仔细看看!”

Click board™ 原理图

Calypso Click Schematic schematic

一步一步来

项目组装

Click Shield for Nucleo-64 accessories 1 image hardware assembly

从选择您的开发板和Click板™开始。以Nucleo 64 with STM32F103RB 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

软件支持

库描述

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

关键功能:

  • calypso_set_app_mode - 此函数用于设置Calypso Click板的选定应用模式。

  • calypso_hw_reset - 此函数用于执行硬件重置。

  • calypso_send_cmd - 此函数用于发送所需的命令。

开源

代码示例

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

/*!
 * @file main.c
 * @brief Calypso Click Example.
 *
 * # Description
 * This example demonstrates the use of Calypso Click board by processing
 * the incoming data and displaying them on the USB UART.
 *
 * The demo application is composed of two sections :
 *
 * ## Application Init
 * Initializes the driver and places AT command mode, tests the communication, 
 * and after that restarts the device, and performs example configuration.
 *
 * ## Application Task
 * It creates a connection to the TCP-UDP echo server, sends a message to it reads it back, 
 * displaces it on the UART terminal, and then closes the connection.
 *
 * ## Additional Function
 * - static void calypso_clear_app_buf ( void )
 * - static void calypso_log_app_buf ( void )
 * - static err_t calypso_process ( void )
 * - static err_t calypso_rsp_check ( uint8_t *rsp )
 * - static void calypso_error_check ( err_t error_flag )
 * - static void calypso_configure_for_example ( void )
 * - static void calypso_example ( void )
 *
 * @author MikroE Team
 *
 */

#include "board.h"
#include "log.h"
#include "calypso.h"
#include "conversions.h"

// Message content
#define MESSAGE_CONTENT                     "Calypso Click board - demo example."

// TCP/UDP example parameters
#define REMOTE_IP                           "77.46.162.162" // TCP/UDP echo server IP address
#define REMOTE_PORT                         "51111"         // TCP/UDP echo server port

// WiFi parameters
#define WIFI_SSID                           "MikroE Public"
#define WIFI_PWD                            "mikroe.guest"

// Application buffer size
#define APP_BUFFER_SIZE                     256
#define PROCESS_BUFFER_SIZE                 256

static calypso_t calypso;
static log_t logger;
static err_t error_flag;

static uint8_t app_buf[ APP_BUFFER_SIZE ] = { 0 };
static int32_t app_buf_len = 0;

/**
 * @brief Calypso clearing application buffer.
 * @details This function clears memory of application buffer and reset its length.
 * @note None.
 */
static void calypso_clear_app_buf ( void );

/**
 * @brief Calypso log application buffer.
 * @details This function logs data from application buffer to USB UART.
 * @note None.
 */
static void calypso_log_app_buf ( void );

/**
 * @brief Calypso 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.
 * See #err_t definition for detailed explanation.
 * @note None.
 */
static err_t calypso_process ( void );

/**
 * @brief Response check.
 * @details This function checks for response and
 * returns the status of response.
 * @param[in] rsp : Expected response.
 * @return @li @c  0 - OK response.
 *         @li @c -1 - Error response.
 *         @li @c -2 - Timeout error.
 *         @li @c -3 - Unknown error.
 * See #err_t definition for detailed explanation.
 */
static err_t calypso_rsp_check ( uint8_t *rsp );

/**
 * @brief Check for errors.
 * @details This function checks for different types of
 * errors and logs them on UART or logs the response if no errors occured.
 * @param[in] error_flag : Error flag to check.
 */
static void calypso_error_check ( err_t error_flag );

/**
 * @brief Calypso configure for example function.
 * @details This function is used to configure device for example.
 */
static void calypso_configure_for_example ( void );

/**
 * @brief Calypso execute example function.
 * @details This function executes TCP/UDP Example.
 */
static void calypso_example ( void );

void application_init ( void ) 
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    calypso_cfg_t calypso_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.
    calypso_cfg_setup( &calypso_cfg );
    CALYPSO_MAP_MIKROBUS( calypso_cfg, MIKROBUS_1 );
    if ( UART_ERROR == calypso_init( &calypso, &calypso_cfg ) ) 
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }
    
    if ( CALYPSO_ERROR == calypso_default_cfg ( &calypso ) )
    {
        log_error( &logger, " Default configuration." );
        for ( ; ; );
    }

    calypso_configure_for_example( );
    
    log_info( &logger, " Application Task " );
}

void application_task ( void ) 
{
    calypso_example( );
}

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 calypso_clear_app_buf ( void ) 
{
    memset( app_buf, 0, app_buf_len );
    app_buf_len = 0;
}

static void calypso_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 ] );
    }
}

static err_t calypso_process ( void ) 
{
    uint8_t rx_buf[ PROCESS_BUFFER_SIZE ] = { 0 };
    int32_t overflow_bytes = 0;
    int32_t rx_cnt = 0;
    int32_t rx_size = calypso_generic_read( &calypso, rx_buf, PROCESS_BUFFER_SIZE );
    if ( ( rx_size > 0 ) && ( rx_size <= APP_BUFFER_SIZE ) ) 
    {
        if ( ( app_buf_len + rx_size ) > APP_BUFFER_SIZE ) 
        {
            overflow_bytes = ( app_buf_len + rx_size ) - APP_BUFFER_SIZE;
            app_buf_len = APP_BUFFER_SIZE - rx_size;
            memmove ( app_buf, &app_buf[ overflow_bytes ], app_buf_len );
            memset ( &app_buf[ app_buf_len ], 0, overflow_bytes );
        }
        for ( rx_cnt = 0; rx_cnt < rx_size; rx_cnt++ ) 
        {
            if ( rx_buf[ rx_cnt ] ) 
            {
                app_buf[ app_buf_len++ ] = rx_buf[ rx_cnt ];
            }
        }
        return CALYPSO_OK;
    }
    return CALYPSO_ERROR;
}

static err_t calypso_rsp_check ( uint8_t *rsp )
{
    uint32_t timeout_cnt = 0;
    uint32_t timeout = 120000;
    calypso_clear_app_buf( );
    calypso_process( );
    while ( ( 0 == strstr( app_buf, rsp ) ) &&
            ( 0 == strstr( app_buf, CALYPSO_RSP_ERROR ) ) )
    {
        calypso_process( );
        if ( timeout_cnt++ > timeout )
        {
            calypso_clear_app_buf( );
            return CALYPSO_ERROR_TIMEOUT;
        }
        Delay_ms ( 1 );
    }
    Delay_ms ( 100 );
    calypso_process( );
    if ( strstr( app_buf, rsp ) )
    {
        return CALYPSO_OK;
    }
    else if ( strstr( app_buf, CALYPSO_RSP_ERROR ) )
    {
        return CALYPSO_ERROR_CMD;
    }
    else
    {
        return CALYPSO_ERROR_UNKNOWN;
    }
}

static void calypso_error_check ( err_t error_flag )
{    
    switch ( error_flag )
    {
        case CALYPSO_OK:
        {
            calypso_log_app_buf( );
            break;
        }
        case CALYPSO_ERROR:
        {
            log_error( &logger, " Overflow!" );
            break;
        }
        case CALYPSO_ERROR_TIMEOUT:
        {
            log_error( &logger, " Timeout!" );
            break;
        }
        case CALYPSO_ERROR_CMD:
        {
            log_error( &logger, " ERROR Response!" );
            break;
        }
        case CALYPSO_ERROR_UNKNOWN:
        default:
        {
            log_error( &logger, " Unknown!" );
            break;
        }
    }
    log_printf( &logger, "- - - - - - - - - - - - - - - -\r\n" );
    Delay_ms ( 500 );
}

static void calypso_configure_for_example ( void )
{
    uint8_t command_data[ APP_BUFFER_SIZE ] = { 0 };

    log_printf( &logger, " Hardware reset. \r\n" );
    calypso_hw_reset( &calypso );
    error_flag = calypso_rsp_check( CALYPSO_RSP_READY );
    calypso_error_check( error_flag );

    log_printf( &logger, " Performing Test. \r\n" );
    calypso_send_cmd( &calypso, CALYPSO_CMD_AT_TEST );
    error_flag = calypso_rsp_check( CALYPSO_RSP_OK );
    calypso_error_check( error_flag );

    log_printf( &logger, " Setting WLAN Mode. \r\n" );
    calypso_send_cmd_with_par( &calypso, CALYPSO_CMD_AT_WLAN_SET_MODE, "STA" );
    error_flag = calypso_rsp_check( CALYPSO_RSP_OK );
    calypso_error_check( error_flag );

    #define SECURITY_TYPE           "WPA_WPA2" 
    strcpy( command_data, WIFI_SSID );
    strcat( command_data, ",," );
    strcat( command_data, SECURITY_TYPE );
    strcat( command_data, "," );
    strcat( command_data, WIFI_PWD );
    strcat( command_data, ",,," );

    log_printf( &logger, " WLAN Connect. \r\n" );
    calypso_send_cmd_with_par( &calypso, CALYPSO_CMD_AT_WLAN_CONNECT, command_data );
    error_flag = calypso_rsp_check( CALYPSO_RSP_OK );
    calypso_error_check( error_flag );
    error_flag = calypso_rsp_check( CALYPSO_RSP_CONNECTED );
    calypso_error_check( error_flag );
}

static void calypso_example ( void )
{
    uint8_t command_data[ APP_BUFFER_SIZE ] = { 0 };
    uint8_t socket_num[ 4 ] = { 0 };
    uint8_t * __generic_ptr socket_num_buf = 0;
    #define SOCKET_OPEN             "+socket:"
    #define SOCKET_CONNECTED        "+connect:"
    #define SOCKET_FAMILY           "INET"
    #define SOCKET_TYPE             "STREAM"
    #define SOCKET_PROTOCOL_TCP     "TCP"
    #define SOCKET_PROTOCOL_UDP     "UDP"
    #define SOCKET_FORMAT_BINATY    "0"
    
    log_printf( &logger, " Create TCP socket. \r\n" );
    strcpy( command_data, SOCKET_FAMILY );
    strcat( command_data, "," );
    strcat( command_data, SOCKET_TYPE );
    strcat( command_data, "," );
    strcat( command_data, SOCKET_PROTOCOL_TCP );
    calypso_send_cmd_with_par( &calypso, CALYPSO_CMD_AT_SOCKET, command_data );
    error_flag = calypso_rsp_check( SOCKET_OPEN );
    calypso_error_check( error_flag );

    socket_num_buf = strstr( app_buf, SOCKET_OPEN ) + strlen ( SOCKET_OPEN );
    if ( socket_num_buf )
    {
        memcpy ( socket_num, socket_num_buf, 2 );
        if ( socket_num[ 1 ] < '0' || socket_num[ 1 ] > '9' )
        {
            socket_num[ 1 ] = 0;
        }
    }
    
    log_printf( &logger, " Connect to the TCP server. \r\n" );
    strcpy( command_data, socket_num );
    strcat( command_data, "," );
    strcat( command_data, SOCKET_FAMILY );
    strcat( command_data, "," );
    strcat( command_data, REMOTE_PORT );
    strcat( command_data, "," );
    strcat( command_data, REMOTE_IP );

    calypso_send_cmd_with_par( &calypso, CALYPSO_CMD_AT_CONNECT, command_data );
    error_flag = calypso_rsp_check( SOCKET_CONNECTED );
    calypso_error_check( error_flag );
    
    uint8_t message_len_buf[ 10 ] = { 0 };
    uint16_t message_len = strlen( MESSAGE_CONTENT );
    uint16_to_str( message_len, message_len_buf );
    l_trim( message_len_buf );
    r_trim( message_len_buf );

    log_printf( &logger, " Send data to the TCP server. \r\n" );
    strcpy( command_data, socket_num );
    strcat( command_data, "," );
    strcat( command_data, SOCKET_FORMAT_BINATY );
    strcat( command_data, "," );
    strcat( command_data, message_len_buf );
    strcat( command_data, "," );
    strcat( command_data, MESSAGE_CONTENT );
    calypso_send_cmd_with_par( &calypso, CALYPSO_CMD_AT_SEND, command_data );
    error_flag = calypso_rsp_check( CALYPSO_RSP_OK );
    calypso_error_check( error_flag );

    log_printf( &logger, " Read data from the TCP server. \r\n" );
    strcpy( command_data, socket_num );
    strcat( command_data, "," );
    strcat( command_data, SOCKET_FORMAT_BINATY );
    strcat( command_data, "," );
    strcat( command_data, message_len_buf );
    calypso_send_cmd_with_par( &calypso, CALYPSO_CMD_AT_RECV, command_data );
    error_flag = calypso_rsp_check( CALYPSO_RSP_OK );
    calypso_error_check( error_flag );
    
    log_printf( &logger, " Closing the TCP connection. \r\n" );
    strcpy( command_data, socket_num );
    calypso_send_cmd_with_par( &calypso, CALYPSO_CMD_AT_CLOSE, command_data );
    error_flag = calypso_rsp_check( CALYPSO_RSP_OK );
    calypso_error_check( error_flag );

    log_printf( &logger, " Create UDP socket. \r\n" );
    strcpy( command_data, SOCKET_FAMILY );
    strcat( command_data, "," );
    strcat( command_data, SOCKET_TYPE );
    strcat( command_data, "," );
    strcat( command_data, SOCKET_PROTOCOL_UDP );
    calypso_send_cmd_with_par( &calypso, CALYPSO_CMD_AT_SOCKET, command_data );
    error_flag = calypso_rsp_check( SOCKET_OPEN );
    calypso_error_check( error_flag );

    socket_num_buf = strstr( app_buf, SOCKET_OPEN ) + strlen ( SOCKET_OPEN );
    if ( socket_num_buf )
    {
        memcpy ( socket_num, socket_num_buf, 2 );
        if ( socket_num[ 1 ] < '0' || socket_num[ 1 ] > '9' )
        {
            socket_num[ 1 ] = 0;
        }
    }
    
    log_printf( &logger, " Connect to the UDP server. \r\n" );
    strcpy( command_data, socket_num );
    strcat( command_data, "," );
    strcat( command_data, SOCKET_FAMILY );
    strcat( command_data, "," );
    strcat( command_data, REMOTE_PORT );
    strcat( command_data, "," );
    strcat( command_data, REMOTE_IP );
    calypso_send_cmd_with_par( &calypso, CALYPSO_CMD_AT_CONNECT, command_data );
    error_flag = calypso_rsp_check( SOCKET_CONNECTED );
    calypso_error_check( error_flag );
    
    log_printf( &logger, " Send data to the UDP server. \r\n" );
    strcpy( command_data, socket_num );
    strcat( command_data, "," );
    strcat( command_data, SOCKET_FORMAT_BINATY );
    strcat( command_data, "," );
    strcat( command_data, message_len_buf );
    strcat( command_data, "," );
    strcat( command_data, MESSAGE_CONTENT );
    calypso_send_cmd_with_par( &calypso, CALYPSO_CMD_AT_SEND, command_data );
    error_flag = calypso_rsp_check( CALYPSO_RSP_OK );
    calypso_error_check( error_flag );

    log_printf( &logger, " Read data from the UDP server. \r\n" );
    strcpy( command_data, socket_num );
    strcat( command_data, "," );
    strcat( command_data, SOCKET_FORMAT_BINATY );
    strcat( command_data, "," );
    strcat( command_data, message_len_buf );
    calypso_send_cmd_with_par( &calypso, CALYPSO_CMD_AT_RECV, command_data );
    error_flag = calypso_rsp_check( CALYPSO_RSP_OK );
    calypso_error_check( error_flag );
    
    log_printf( &logger, " Closing the UDP connection. \r\n" );
    strcpy( command_data, socket_num );
    calypso_send_cmd_with_par( &calypso, CALYPSO_CMD_AT_CLOSE, command_data );
    error_flag = calypso_rsp_check( CALYPSO_RSP_OK );
    calypso_error_check( error_flag );
    
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
}

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

额外支持

资源

喜欢这个项目吗?

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