通过 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™ 配备了包含易于使用功能和示例代码的库,可用于进一步开发。
功能概述
开发板
Nucleo 32开发板搭载STM32F031K6 MCU,提供了一种经济且灵活的平台,适用于使用32引脚封装的STM32微控制器进行实验。该开发板具有Arduino™ Nano连接性,便于通过专用扩展板进行功能扩展,并且支持mbed,使其能够无缝集成在线资源。板载集成
ST-LINK/V2-1调试器/编程器,支持通过USB重新枚举,提供三种接口:虚拟串口(Virtual Com port)、大容量存储和调试端口。该开发板的电源供应灵活,可通过USB VBUS或外部电源供电。此外,还配备了三个LED指示灯(LD1用于USB通信,LD2用于电源
指示,LD3为用户可控LED)和一个复位按钮。STM32 Nucleo-32开发板支持多种集成开发环境(IDEs),如IAR™、Keil®和基于GCC的IDE(如AC6 SW4STM32),使其成为开发人员的多功能工具。

微控制器概述
MCU卡片 / MCU

建筑
ARM Cortex-M0
MCU 内存 (KB)
32
硅供应商
STMicroelectronics
引脚数
32
RAM (字节)
4096
你完善了我!
配件
Click Shield for Nucleo-32是扩展您的开发板功能的理想选择,专为STM32 Nucleo-32引脚布局设计。Click Shield for Nucleo-32提供了两个mikroBUS™插座,可以添加来自我们不断增长的Click板™系列中的任何功能。从传感器和WiFi收发器到电机控制和音频放大器,我们应有尽有。Click Shield for Nucleo-32与STM32 Nucleo-32开发板兼容,为用户提供了一种经济且灵活的方式,使用任何STM32微控制器快速创建原型,并尝试各种性能、功耗和功能的组合。STM32 Nucleo-32开发板无需任何独立的探针,因为它集成了ST-LINK/V2-1调试器/编程器,并随附STM32全面的软件HAL库和各种打包的软件示例。这个开发平台为用户提供了一种简便且通用的方式,将STM32 Nucleo-32兼容开发板与他们喜欢的Click板™结合,应用于即将开展的项目中。
使用的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”替换为要显示的参数。

软件支持
库描述
该库包含 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