初学者
10 分钟

使用NORA-W256WS和TM4C1294KCPDT轻松收集、存储和分析各种应用数据

无线奇迹在等待 – 今天就提升您的技术体验!

IoT ExpressLink 3 Click with Fusion for Tiva v8

已发布 6月 27, 2024

点击板

IoT ExpressLink 3 Click

开发板

Fusion for Tiva v8

编译器

NECTO Studio

微控制器单元

TM4C1294KCPDT

通过 IoT ExpressLink,您可以释放项目的潜力,无缝连接到云端。无需专业知识——我们已经为您提供了全面的安全保障!

A

A

硬件概览

它是如何工作的?

IoT ExpressLink 3 Click 基于 u-blox 的 NORA-W256WS,这是一个独立的多无线电模块。其核心是 ESP32-S3,一款用于无线通信的射频模块,以及来自 Esspressif 的双核 MCU。这个强大的 32 位微控制器拥有 512KB 的 RAM 和 8192KB 的闪存。它具有主机软件 OTA、模块固件 OTA、安全启动、端到端安全(TLS)、MQTT、无状态 AT 命令、WPA/WPA2/WPA3 等功能。预先烧录的 AWS IoT ExpressLink 软件提供即插即用的亚马逊 

Web 服务 (AWS) 连接,您可以利用 AWS 提供的便捷云访问应用程序和所有其他服务。NORA-W256WS 模块带有一个印刷天线,可为两种无线电服务,但一次只能使用一种。模块还配有一个 RGB LED,可视化系统状态。IoT ExpressLink 3 Click 使用标准的 2 线 UART 接口与主 MCU 通信,常用的 UART RX 和 TX 引脚以 115200bps 的波特率工作。ExpressLink 事件可以通过 EVT 引脚进行监控。模块进入待机状态并停止 Wi-Fi,直

到唤醒 WK 引脚被断言。切换此引脚时,模块处于深度睡眠模式下可以进入活动唤醒模式。模块可以通过 RST 引脚复位(重启)。您也可以通过 RESET 按钮重置模块。此外,还可以通过 RSN 引脚重置 ExpressLink。此 Click board™ 只能在 3.3V 逻辑电压水平下运行。使用具有不同逻辑电平的 MCU 之前,板必须进行适当的逻辑电压水平转换。此外,这款 Click board™ 配备了包含易于使用功能和示例代码的库,可用于进一步开发。

IoT ExpressLink 3 Click hardware overview image

功能概述

开发板

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板™(超过一千块板),其数量每天都在增长,它涵盖了原型制作和开发的许多方面。

Fusion for Tiva v8 horizontal image

微控制器概述 

MCU卡片 / MCU

default

类型

8th Generation

建筑

ARM Cortex-M4

MCU 内存 (KB)

512

硅供应商

Texas Instruments

引脚数

128

RAM (字节)

262144

使用的MCU引脚

mikroBUS™映射器

Reset Nora Module
PD0
AN
Device Enable / ID SEL
PK3
RST
Chip Select / ID COMM
PH0
CS
NC
NC
SCK
NC
NC
MISO
NC
NC
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
Module Wake Up
PL4
PWM
Event Interrupt
PQ4
INT
UART TX
PK1
TX
UART RX
PK0
RX
NC
NC
SCL
NC
NC
SDA
NC
NC
5V
Ground
GND
GND
1

“仔细看看!”

Click board™ 原理图

IoT ExpressLink 3 Click Schematic schematic

一步一步来

项目组装

Fusion for PIC v8 front image hardware assembly

从选择您的开发板和Click板™开始。以Fusion for Tiva v8作为您的开发板开始

Fusion for PIC v8 front image hardware assembly
GNSS2 Click front image hardware assembly
SiBRAIN for PIC32MZ1024EFK144 front image hardware assembly
v8 SiBRAIN Access MB 1 - upright/background hardware assembly
Necto image step 2 hardware assembly
Necto image step 3 hardware assembly
Necto image step 4 hardware assembly
NECTO Compiler Selection Step Image hardware assembly
NECTO Output Selection Step Image hardware assembly
Necto image step 6 hardware assembly
Necto image step 7 hardware assembly
Necto image step 8 hardware assembly
Necto image step 9 hardware assembly
Necto image step 10 hardware assembly
Necto PreFlash Image 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”替换为要显示的参数。

软件支持

库描述

该库包含 IoT ExpressLink 3 Click 驱动程序的 API。

关键功能:

  • iotexpresslink3_reset_device - 此功能通过切换 RST 引脚状态来重置设备。

  • iotexpresslink3_send_cmd - 此功能通过使用 UART 串行接口发送命令字符串。

开源

代码示例

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

/*!
 * @file main.c
 * @brief IoT ExpressLink 3 Click Example.
 *
 * # Description
 * This example demonstrates the use of IoT ExpressLink 3 click board by bridging the USB UART
 * to mikroBUS UART which allows the click board to establish a connection with
 * the IoT ExpressLink over the Quick Connect demo application without an AWS account.
 *
 * The demo application is composed of two sections :
 *
 * ## Application Init
 * Initializes the driver, resets the click board to factory default settings, reads
 * and displays the vendor model and thing name on the USB UART, sets the WiFi credentials,
 * and attempts to connect to the AWS Cloud. If the initial attempt fails and the error
 * message "Failed to access network" or "Failed to login AWS (MQTT) broker" appears,
 * check the WiFi credentials and try running the example again.
 *
 * ## Application Task
 * All data received from the USB UART will be forwarded to mikroBUS UART, and vice versa.
 * At this point you should disconnect from the UART terminal and run the Quick Connect
 * demo application.
 *
 * ## Additional Function
 * - static void iotexpresslink3_clear_app_buf ( void )
 * - static err_t iotexpresslink3_process ( iotexpresslink3_t *ctx )
 * - static err_t iotexpresslink3_read_response ( iotexpresslink3_t *ctx )
 *
 * @note
 * To run the demo, follow the below steps:
 * 1. If you opened a terminal application in the previous step, be sure to disconnect that
 *    application from the serial port. 
 * 2. Download the Quick Connect executable: 
 *    Mac: https://quickconnectexpresslinkutility.s3.us-west-2.amazonaws.com/QuickConnect_v1.9_macos.x64.tar.gz
 *    Windows: https://quickconnectexpresslinkutility.s3.us-west-2.amazonaws.com/QuickConnect_v1.9_windows.x64.zip
 *    Linux: https://quickconnectexpresslinkutility.s3.us-west-2.amazonaws.com/QuickConnect_v1.9_linux.x64.tar.gz
 * 3. Unzip the package, and follow the steps from the README file.
 * 
 * The demo will connect to IoT ExpressLink and give you an URL that you can use to visualize data
 * flowing from the device to the cloud using AT+SEND commands. The demo will run for up
 * to two minutes, and afterwards, you will be able to type AT+SEND commands yourself and
 * see the data coming in on the visualizer.
 *
 * @author Stefan Filipovic
 *
 */

#include "board.h"
#include "log.h"
#include "iotexpresslink3.h"

// Enter valid WiFi credentials below
#define WIFI_SSID               "MikroE Public"     // WiFi SSID
#define WIFI_PASS               "mikroe.guest"      // WiFi Password

// Application buffer size
#define APP_BUFFER_SIZE         500
#define PROCESS_BUFFER_SIZE     200

static iotexpresslink3_t iotexpresslink3;
static log_t logger;

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

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

/**
 * @brief IoT ExpressLink 3 data reading function.
 * @details This function reads data from device and concatenates data to application buffer. 
 * @param[in] ctx : Click context object.
 * See #iotexpresslink3_t object definition for detailed explanation.
 * @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 iotexpresslink3_process ( iotexpresslink3_t *ctx );

/**
 * @brief IoT ExpressLink read response function.
 * @details This function waits for a response message, reads and displays it on the USB UART.
 * @param[in] ctx : Click context object.
 * See #iotexpresslink_t object definition for detailed explanation.
 * @return @li @c  0 - OK response.
 *         @li @c -2 - Timeout error.
 *         @li @c -3 - Command error.
 *         @li @c -4 - Unknown error.
 * See #err_t definition for detailed explanation.
 * @note None.
 */
static err_t iotexpresslink3_read_response ( iotexpresslink3_t *ctx );

void application_init ( void ) 
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    iotexpresslink3_cfg_t iotexpresslink3_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.
    iotexpresslink3_cfg_setup( &iotexpresslink3_cfg );
    IOTEXPRESSLINK3_MAP_MIKROBUS( iotexpresslink3_cfg, MIKROBUS_1 );
    if ( UART_ERROR == iotexpresslink3_init( &iotexpresslink3, &iotexpresslink3_cfg ) ) 
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }
    
    log_printf( &logger, "Reset device\r\n\n" );
    iotexpresslink3_reset_device ( &iotexpresslink3 );
    Delay_ms ( 2000 );

    log_printf( &logger, "Factory reset\r\n" );
    strcpy ( app_buf, IOTEXPRESSLINK3_CMD_FACTORY_RESET );
    iotexpresslink3_send_cmd ( &iotexpresslink3, app_buf );
    iotexpresslink3_read_response ( &iotexpresslink3 );
    Delay_ms ( 2000 );
    
    log_printf( &logger, "Vendor model\r\n" );
    strcpy ( app_buf, IOTEXPRESSLINK3_CMD_CONF_CHECK );
    strcat ( app_buf, IOTEXPRESSLINK3_CMD_SEPARATOR );
    strcat ( app_buf, IOTEXPRESSLINK3_CONF_KEY_ABOUT );
    iotexpresslink3_send_cmd ( &iotexpresslink3, app_buf );
    iotexpresslink3_read_response ( &iotexpresslink3 );
    
    log_printf( &logger, "Thing name\r\n" );
    strcpy ( app_buf, IOTEXPRESSLINK3_CMD_CONF_CHECK );
    strcat ( app_buf, IOTEXPRESSLINK3_CMD_SEPARATOR );
    strcat ( app_buf, IOTEXPRESSLINK3_CONF_KEY_THING_NAME );
    iotexpresslink3_send_cmd ( &iotexpresslink3, app_buf );
    iotexpresslink3_read_response ( &iotexpresslink3 );
    
    log_printf( &logger, "WiFi SSID\r\n" );
    strcpy ( app_buf, IOTEXPRESSLINK3_CMD_CONF );
    strcat ( app_buf, IOTEXPRESSLINK3_CMD_SEPARATOR );
    strcat ( app_buf, IOTEXPRESSLINK3_CONF_KEY_SSID );
    strcat ( app_buf, IOTEXPRESSLINK3_CMD_SIGN_EQUAL );
    strcat ( app_buf, WIFI_SSID );
    iotexpresslink3_send_cmd ( &iotexpresslink3, app_buf );
    iotexpresslink3_read_response ( &iotexpresslink3 );
    
    log_printf( &logger, "WiFi Password\r\n" );
    strcpy ( app_buf, IOTEXPRESSLINK3_CMD_CONF );
    strcat ( app_buf, IOTEXPRESSLINK3_CMD_SEPARATOR );
    strcat ( app_buf, IOTEXPRESSLINK3_CONF_KEY_PASSPHRASE );
    strcat ( app_buf, IOTEXPRESSLINK3_CMD_SIGN_EQUAL );
    strcat ( app_buf, WIFI_PASS );
    iotexpresslink3_send_cmd ( &iotexpresslink3, app_buf );
    iotexpresslink3_read_response ( &iotexpresslink3 );
    
    log_printf( &logger, "Try to connect\r\n" );
    strcpy ( app_buf, IOTEXPRESSLINK3_CMD_CONNECT );
    iotexpresslink3_send_cmd ( &iotexpresslink3, app_buf );
    iotexpresslink3_read_response ( &iotexpresslink3 );
    
    log_info( &logger, " Application Task " );
    
    log_printf( &logger, "Now close the UART terminal and switch to the QuickConnect app\r\n" );
    Delay_ms ( 1000 );
    
    uart_set_blocking( &logger.uart, false );
}

void application_task ( void ) 
{
    app_buf_len = uart_read( &logger.uart, app_buf, PROCESS_BUFFER_SIZE );
    if ( app_buf_len > 0 ) 
    {
        uart_write ( &iotexpresslink3.uart, app_buf, app_buf_len );
        iotexpresslink3_clear_app_buf( );
    }
    app_buf_len = uart_read( &iotexpresslink3.uart, app_buf, PROCESS_BUFFER_SIZE );
    if ( app_buf_len > 0 ) 
    {
        uart_write ( &logger.uart, app_buf, app_buf_len );
        iotexpresslink3_clear_app_buf( );
    }
}

void main ( void ) 
{
    application_init( );

    for ( ; ; ) 
    {
        application_task( );
    }
}

static void iotexpresslink3_clear_app_buf ( void ) 
{
    memset( app_buf, 0, APP_BUFFER_SIZE );
    app_buf_len = 0;
}

static void iotexpresslink3_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 iotexpresslink3_process ( iotexpresslink3_t *ctx ) 
{
    uint8_t rx_buf[ PROCESS_BUFFER_SIZE ] = { 0 };
    int32_t overflow_bytes = 0;
    int32_t rx_cnt = 0;
    int32_t rx_size = iotexpresslink3_generic_read( ctx, 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 IOTEXPRESSLINK3_OK;
    }
    return IOTEXPRESSLINK3_ERROR;
}


static err_t iotexpresslink3_read_response ( iotexpresslink3_t *ctx ) 
{
    uint32_t timeout_cnt = 0;
    uint32_t timeout = 30000;
    iotexpresslink3_clear_app_buf ( );
    iotexpresslink3_process( ctx );
    while ( ( 0 == strstr( app_buf, IOTEXPRESSLINK3_RSP_OK ) ) &&
            ( 0 == strstr( app_buf, IOTEXPRESSLINK3_RSP_ERR ) ) )
    {
        iotexpresslink3_process( ctx );
        if ( timeout_cnt++ > timeout )
        {
            iotexpresslink3_clear_app_buf( );
            return IOTEXPRESSLINK3_ERROR_TIMEOUT;
        }
        Delay_ms( 1 );
    }
    Delay_ms ( 100 );
    iotexpresslink3_process( ctx );
    if ( app_buf_len > 0 ) 
    {
        log_printf( &logger, "%s\r\n", app_buf );
    }
    if ( strstr( app_buf, IOTEXPRESSLINK3_RSP_OK ) )
    {
        iotexpresslink3_clear_app_buf( );
        return IOTEXPRESSLINK3_OK;
    }
    else if ( strstr( app_buf, IOTEXPRESSLINK3_RSP_ERR ) )
    {
        iotexpresslink3_clear_app_buf( );
        return IOTEXPRESSLINK3_ERROR_CMD;
    }
    iotexpresslink3_clear_app_buf( );
    return IOTEXPRESSLINK3_ERROR_UNKNOWN;
}

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

额外支持

资源

喜欢这个项目吗?

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