出于对简单性和安全性的承诺,我们的目标是让用户轻松将他们的设备安全地连接到云端,并无缝集成AWS服务的丰富功能。
A
A
硬件概览
它是如何工作的?
IoT ExpressLink Click 基于 Espressif Systems 的 ESP32-C3-MINI-1-N4-A,这是一个 2.4GHz WiFi(802.11 b/g/n)和 Bluetooth® 5 LE 组合模块,配备板载 PCB 天线和 AWS IoT ExpressLink 固件(锁定到 AWS)。该模块的核心是 ESP32C3 系列 SoC RISCV 单核 32 位微处理器(ESP32-C3FN4),该芯片嵌入了 4MB 的闪存,时钟速度高达 160MHz。由于闪存在 ESP32-C3FN4 芯片中封装而不是集成在模块中,因此 ESP32-C3-MINI-1-N4-A 具有较小的封装尺寸。凭借其丰富的功能集,能够实现 IoT ExpressLink 服务,该 Click board™ 非常适合智能家
居、工业自动化、医疗保健、消费电子和通用 IoT 传感器集线器及数据记录应用。IoT ExpressLink Click 通过 UART 通信与主机 MCU 进行接口通信,涉及使用 RX 和 TX 引脚发送 AT 命令,操作速率为 115200bps。除了 UART 引脚外,此 Click board™ 还利用了 mikroBUS™ 插座的其他引脚来增强其功能。例如,WK 引脚用作模块唤醒引脚,EVT 引脚用于检测操作期间的重大事件,设备使能引脚 RST 提供一个用于打开/关闭模块的开关操作。在板子的左侧,可以找到一个额外的未填充接头,该接头提供对调试功能的全面支持。通过此接头,用户可以使用 JTAG
接口进行调试,通过 JTAG 接口引脚(TDO、TCK、TDI 和 TMS)提供支持。在板子的右侧,还有一组未填充的接头,例如用于调试的额外 UART 引脚和具有用户可配置通用输入输出引脚的接头。此 Click board™ 只能在 3.3V 逻辑电压水平下操作。在使用具有不同逻辑电平的 MCU 之前,必须执行适当的逻辑电压电平转换。此外,这款 Click board™ 配备了包含易用功能的库和示例代码,可作为进一步开发的参考。
功能概述
开发板
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板™(超过一千块板),其数量每天都在增长,它涵盖了原型制作和开发的许多方面。
微控制器概述
MCU卡片 / MCU

类型
8th Generation
建筑
ARM Cortex-M4
MCU 内存 (KB)
1024
硅供应商
Texas Instruments
引脚数
212
RAM (字节)
262144
使用的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 Click 驱动程序的 API。
关键功能:
iotexpresslink_reset_device
- 该函数通过切换RST引脚状态来重置设备。iotexpresslink_send_cmd
- 该函数通过使用UART串行接口发送命令字符串。
开源
代码示例
完整的应用程序代码和一个现成的项目可以通过NECTO Studio包管理器直接安装到NECTO Studio。 应用程序代码也可以在MIKROE的GitHub账户中找到。
/*!
* @file main.c
* @brief IoT ExpressLink Click Example.
*
* # Description
* This example demonstrates the use of IoT ExpressLink 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 iotexpresslink_clear_app_buf ( void )
* - static err_t iotexpresslink_process ( uart_t *uart )
* - static err_t iotexpresslink_read_response ( iotexpresslink_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 "iotexpresslink.h"
#define PROCESS_BUFFER_SIZE 500
// Enter valid WiFi credentials below
#define WIFI_SSID "MikroE Public" // WiFi SSID
#define WIFI_PASS "mikroe.guest" // WiFi Password
static iotexpresslink_t iotexpresslink;
static log_t logger;
static uint8_t app_buf[ PROCESS_BUFFER_SIZE ] = { 0 };
static int32_t app_buf_len = 0;
/**
* @brief IoT ExpressLink clearing application buffer.
* @details This function clears memory of application buffer and reset its length.
* @note None.
*/
static void iotexpresslink_clear_app_buf ( void );
/**
* @brief IoT ExpressLink data reading function.
* @details This function reads data from device and concatenates data to application buffer.
* @param[in] ctx : Click context object.
* See #iotexpresslink_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 iotexpresslink_process ( iotexpresslink_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 iotexpresslink_read_response ( iotexpresslink_t *ctx );
void application_init ( void )
{
log_cfg_t log_cfg; /**< Logger config object. */
iotexpresslink_cfg_t iotexpresslink_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.
iotexpresslink_cfg_setup( &iotexpresslink_cfg );
IOTEXPRESSLINK_MAP_MIKROBUS( iotexpresslink_cfg, MIKROBUS_1 );
if ( UART_ERROR == iotexpresslink_init( &iotexpresslink, &iotexpresslink_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
log_printf( &logger, "Reset device\r\n\n" );
iotexpresslink_reset_device ( &iotexpresslink );
Delay_ms ( 2000 );
log_printf( &logger, "Factory reset\r\n" );
strcpy ( app_buf, IOTEXPRESSLINK_CMD_FACTORY_RESET );
iotexpresslink_send_cmd ( &iotexpresslink, app_buf );
iotexpresslink_read_response ( &iotexpresslink );
Delay_ms ( 2000 );
log_printf( &logger, "Vendor model\r\n" );
strcpy ( app_buf, IOTEXPRESSLINK_CMD_CONF_CHECK );
strcat ( app_buf, IOTEXPRESSLINK_CMD_SEPARATOR );
strcat ( app_buf, IOTEXPRESSLINK_CONF_KEY_ABOUT );
iotexpresslink_send_cmd ( &iotexpresslink, app_buf );
iotexpresslink_read_response ( &iotexpresslink );
log_printf( &logger, "Thing name\r\n" );
strcpy ( app_buf, IOTEXPRESSLINK_CMD_CONF_CHECK );
strcat ( app_buf, IOTEXPRESSLINK_CMD_SEPARATOR );
strcat ( app_buf, IOTEXPRESSLINK_CONF_KEY_THING_NAME );
iotexpresslink_send_cmd ( &iotexpresslink, app_buf );
iotexpresslink_read_response ( &iotexpresslink );
log_printf( &logger, "WiFi SSID\r\n" );
strcpy ( app_buf, IOTEXPRESSLINK_CMD_CONF );
strcat ( app_buf, IOTEXPRESSLINK_CMD_SEPARATOR );
strcat ( app_buf, IOTEXPRESSLINK_CONF_KEY_SSID );
strcat ( app_buf, IOTEXPRESSLINK_CMD_SIGN_EQUAL );
strcat ( app_buf, WIFI_SSID );
iotexpresslink_send_cmd ( &iotexpresslink, app_buf );
iotexpresslink_read_response ( &iotexpresslink );
log_printf( &logger, "WiFi Password\r\n" );
strcpy ( app_buf, IOTEXPRESSLINK_CMD_CONF );
strcat ( app_buf, IOTEXPRESSLINK_CMD_SEPARATOR );
strcat ( app_buf, IOTEXPRESSLINK_CONF_KEY_PASSPHRASE );
strcat ( app_buf, IOTEXPRESSLINK_CMD_SIGN_EQUAL );
strcat ( app_buf, WIFI_PASS );
iotexpresslink_send_cmd ( &iotexpresslink, app_buf );
iotexpresslink_read_response ( &iotexpresslink );
log_printf( &logger, "Try to connect\r\n" );
strcpy ( app_buf, IOTEXPRESSLINK_CMD_CONNECT );
iotexpresslink_send_cmd ( &iotexpresslink, app_buf );
iotexpresslink_read_response ( &iotexpresslink );
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 ( &iotexpresslink.uart, app_buf, app_buf_len );
iotexpresslink_clear_app_buf( );
}
app_buf_len = uart_read( &iotexpresslink.uart, app_buf, PROCESS_BUFFER_SIZE );
if ( app_buf_len > 0 )
{
uart_write ( &logger.uart, app_buf, app_buf_len );
iotexpresslink_clear_app_buf( );
}
}
void main ( void )
{
application_init( );
for ( ; ; )
{
application_task( );
}
}
static void iotexpresslink_clear_app_buf ( void )
{
memset( app_buf, 0, app_buf_len );
app_buf_len = 0;
}
static err_t iotexpresslink_process ( iotexpresslink_t *ctx )
{
uint8_t rx_buf[ PROCESS_BUFFER_SIZE ] = { 0 };
int32_t rx_size = 0;
rx_size = iotexpresslink_generic_read( ctx, rx_buf, PROCESS_BUFFER_SIZE );
if ( rx_size > 0 )
{
int32_t buf_cnt = app_buf_len;
if ( ( ( app_buf_len + rx_size ) > PROCESS_BUFFER_SIZE ) && ( app_buf_len > 0 ) )
{
buf_cnt = PROCESS_BUFFER_SIZE - ( ( app_buf_len + rx_size ) - PROCESS_BUFFER_SIZE );
memmove ( app_buf, &app_buf[ PROCESS_BUFFER_SIZE - buf_cnt ], buf_cnt );
}
for ( int32_t rx_cnt = 0; rx_cnt < rx_size; rx_cnt++ )
{
if ( rx_buf[ rx_cnt ] )
{
app_buf[ buf_cnt++ ] = rx_buf[ rx_cnt ];
if ( app_buf_len < PROCESS_BUFFER_SIZE )
{
app_buf_len++;
}
}
}
return IOTEXPRESSLINK_OK;
}
return IOTEXPRESSLINK_ERROR;
}
static err_t iotexpresslink_read_response ( iotexpresslink_t *ctx )
{
uint32_t timeout_cnt = 0;
uint32_t timeout = 30000;
memset( app_buf, 0, PROCESS_BUFFER_SIZE );
app_buf_len = 0;
iotexpresslink_process( ctx );
while ( ( 0 == strstr( app_buf, IOTEXPRESSLINK_RSP_OK ) ) &&
( 0 == strstr( app_buf, IOTEXPRESSLINK_RSP_ERR ) ) )
{
iotexpresslink_process( ctx );
if ( timeout_cnt++ > timeout )
{
iotexpresslink_clear_app_buf( );
return IOTEXPRESSLINK_ERROR_TIMEOUT;
}
Delay_ms( 1 );
}
Delay_ms ( 100 );
iotexpresslink_process( ctx );
if ( app_buf_len > 0 )
{
log_printf( &logger, "%s\r\n", app_buf );
}
if ( strstr( app_buf, IOTEXPRESSLINK_RSP_OK ) )
{
iotexpresslink_clear_app_buf( );
return IOTEXPRESSLINK_OK;
}
else if ( strstr( app_buf, IOTEXPRESSLINK_RSP_ERR ) )
{
iotexpresslink_clear_app_buf( );
return IOTEXPRESSLINK_ERROR_CMD;
}
iotexpresslink_clear_app_buf( );
return IOTEXPRESSLINK_ERROR_UNKNOWN;
}
// ------------------------------------------------------------------------ END