提升您的智能基础设施及所有需实现可靠设备到云通信的嵌入式系统性能
A
A
硬件概览
它是如何工作的?
XPort EDGE Click 基于 Lantronix 的 XPE200100S 模块,采用与原始 XPort 系列相同的紧凑封装,提供新一代有线以太网网关和嵌入式设备服务器功能。该板集成 XPort EDGE 平台与 Percepxion™ 云端物联网边缘解决方案,旨在为工业和物联网应用提供安全、可靠、可管理的以太网连接。板载集成 RJ45 接口含磁性器件,支持符合 IEEE 802.3 标准的 10/100 Mbps 以太网通信,具备 HP Auto-MDIX 自动交叉检测及自动协商能力,支持全双工与半双工模式,所有功能均封装于标准以太网接口中。模块支持多种先进网络协议,包括 IPv4/IPv6、TCP/IP、UDP/IP、DHCP、BOOTP、ARP、ICMP、Auto-IP、DNS、SNMP v1/v2、Telnet 和 HTTP,适用于多种网络应用场景。XPort EDGE Click 板内建 Lantronix 可靠的
TruPort® Serial 与 TruPort® Socket 技术,可实现串口协议的透明传输,支持多会话 TCP、UDP 及 HTTP(S) 连接,确保数据通信的安全与稳定。串口最高数据速率支持 4 Mbps,用户可通过软件进行配置。模块还预集成 Percepxion™ 平台,支持远程设备管理、实时监控及应用集成,简化本地与云端部署流程。其一大亮点是由 Lantronix Infinishield™ Security 提供支持的强大安全架构,涵盖安全启动、固件在线升级(FOTA)、基于 EAPOL 的安全网络接入、基于角色的访问控制、加密密钥与配置的数据静态保护,以及对网络服务的精细策略管理。这些内建安全机制无需额外集成即可满足现代网络安全标准。XPort EDGE Click 具备工业级稳定性、先进的网络能力与全面的设备级安全特性,为现代嵌入式系统提供
完整的以太网连接与设备管理解决方案。模块通过 UART 接口与主控设备通信,同时提供三个可配置通用 I/O 引脚(CP1、CP2、CP3),可用于流控/调制解调器控制或通用信号。此外,XPort 模块配备 8MB 闪存,用于存储固件与网页内容,支持远程管理与功能定制。如前所述,模块通过 RJ45 端口直接接入以太网,并在接口前部集成双色 LED 指示灯,用于实时显示网络连接状态。本 Click board™ 仅支持 3.3V 逻辑电压工作。如需搭配其他逻辑电压的 MCU 使用,须进行适当电平转换。该板还附带软件库,包含函数接口与示例代码,便于开发者快速上手并进行二次开发。
功能概述
开发板
PIC18F57Q43 Curiosity Nano 评估套件是一款尖端的硬件平台,旨在评估 PIC18-Q43 系列内的微控制器。其设计的核心是包含了功能强大的 PIC18F57Q43 微控制器(MCU),提供先进的功能和稳健的性能。这个评估套件的关键特点包括一个黄 色用户 LED 和一个响应灵敏的机械用户开关,提供无
缝的交互和测试。为一个 32.768kHz 水晶振荡器足迹提供支持,确保精准的定时能力。套件内置的调试器拥有一个绿色电源和状态 LED,使编程和调试变得直观高效。此外,增强其实用性的还有虚拟串行端口 (CDC)和一个调试 GPIO 通道(DGI GPIO),提供广泛的连接选项。该套件通过 USB 供电,拥有由
MIC5353 LDO 调节器提供支持的可调目标电压功能,确保在 1.8V 至 5.1V 的输出电压范围内稳定运行,最大输出电流为 500mA,受环境温度和电压限制。
微控制器概述
MCU卡片 / MCU

建筑
PIC
MCU 内存 (KB)
128
硅供应商
Microchip
引脚数
48
RAM (字节)
8196
你完善了我!
配件
Curiosity Nano Base for Click boards 是一款多功能硬件扩展平台,专为简化 Curiosity Nano 套件与扩展板之间的集成而设计,特别针对符合 mikroBUS™ 标准的 Click 板和 Xplained Pro 扩展板。这款创新的基板(屏蔽板)提供了无缝的连接和扩展可能性,简化了实验和开发过程。主要特点包括从 Curiosity Nano 套件提供 USB 电源兼容性,以及为增强灵活性而提供的另一种外部电源输入选项。板载锂离子/锂聚合物充电器和管理电路确保电池供电应用的平稳运行,简化了使用和管理。此外,基板内置了一个固定的 3.3V 电源供应单元,专用于目标和 mikroBUS™ 电源轨,以及一个固定的 5.0V 升压转换器,专供 mikroBUS™ 插座的 5V 电源轨,为各种连接设备提供稳定的电力供应。
RJ45 UTP(非屏蔽双绞线)电缆是一种广泛应用于家庭和商用场景中的以太网连接线缆。该电缆两端配有 RJ45 接头,可直接连接路由器、交换机、计算机及其他网络设备。UTP 电缆由四对铜线组成,每对线缆经过扭绞处理,有效降低电磁干扰,无需额外屏蔽层。根据性能标准不同,常见类型包括 Cat5e、Cat6 和 Cat6a,分别支持不同的数据传输速率与带宽需求。RJ45 UTP 电缆广泛应用于有线网络接入、数据传输和 VoIP 系统,是实现高速网络通信的可靠选择。其即插即用的设计简化了安装流程,而双绞结构则保障了中等距离内的信号完整性。非常适合结构化布线和局域网(LAN)搭建,RJ45 UTP 电缆依然是现代网络基础设施中的关键组成部分。

使用的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”替换为要显示的参数。

软件支持
库描述
XPort EDGE Click 演示应用程序使用 NECTO Studio开发,确保与 mikroSDK 的开源库和工具兼容。该演示设计为即插即用,可与所有具有 mikroBUS™ 插座的 开发板、入门板和 mikromedia 板完全兼容,用于快速实现和测试。
示例描述
本示例演示了 XPort EDGE Click 板的基本功能。应用程序初始化模块,获取设备与接口信息,执行诊断命令(如 ping 指定地址),并允许用户通过 Web 浏览器访问设备的网页界面。此外,还通过 UART 终端提供 CLI(命令行接口)模式,支持进一步交互配置。
关键功能:
xportedge_cfg_setup- 初始化 Click 配置结构体为默认值。xportedge_init- 初始化 Click 板所需的全部引脚和外设。xportedge_reset_device- 通过切换 RST 引脚状态重置设备。xportedge_send_cmd- 通过 UART 接口发送命令字符串。xportedge_list_commands- 发送问号字符列出当前命令级别下的所有可用命令。
应用初始化
初始化日志记录器与 XPort EDGE Click 驱动,执行设备复位,获取设备信息,并在诊断过程中 ping 指定 IP 地址。应用程序还会检索设备的 IP 地址,用户随后可通过网页浏览器访问其 Web 界面。完成这些操作后,系统进入 CLI 模式,支持命令行方式的高级交互。
应用任务
持续监听 UART 通信,将命令和响应在 XPort EDGE Click 板与日志终端之间实时转发。用户可通过 UART 终端与设备交互,进行配置、状态查询及故障诊断等操作。
开源
代码示例
完整的应用程序代码和一个现成的项目可以通过NECTO Studio包管理器直接安装到NECTO Studio。 应用程序代码也可以在MIKROE的GitHub账户中找到。
/*!
* @file main.c
* @brief XPort EDGE Click Example.
*
* # Description
* This example demonstrates the functionality of the XPort EDGE Click board. It initializes the module,
* retrieves the device and interface information, performs diagnostic commands such as pinging a specific
* address, and allows the user to access the device via its web interface. Additionally, it provides a
* CLI (Command Line Interface) mode to UART terminal for further interaction with the device.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initializes the logger and the XPort EDGE Click driver, performs a device reset, retrieves device
* information, and pings the specific address in diagnostics. The application retrieves the device's IP address,
* enabling the user to connect via a web browser and access the web interface. Finally, it enters CLI mode
* for advanced command interactions.
*
* ## Application Task
* Continuously monitors UART communication, relaying commands and responses between the XPort EDGE Click
* board and the logger. This allows real-time interaction with the device through the UART Terminal for
* configuration and diagnostics.
*
* ## Additional Function
* - static void xportedge_clear_app_buf ( void )
* - static void xportedge_log_app_buf ( void )
* - static err_t xportedge_process ( xportedge_t *ctx )
* - static err_t xportedge_read_response ( xportedge_t *ctx )
*
* @note
* Ensure the XPort EDGE Click board is properly connected to the network.
* The application uses a predefined address to test connectivity via the ping diagnostic command.
*
* @author Stefan Filipovic
*
*/
#include "board.h"
#include "log.h"
#include "xportedge.h"
// Link or IP address for pinging
#define ADDRESS_TO_PING "https://www.mikroe.com"
// Application buffer size
#define APP_BUFFER_SIZE 200
#define PROCESS_BUFFER_SIZE 100
static xportedge_t xportedge;
static log_t logger;
static uint8_t app_buf[ APP_BUFFER_SIZE ] = { 0 };
static int32_t app_buf_len = 0;
/**
* @brief XPort EDGE clearing application buffer.
* @details This function clears memory of application buffer and reset its length.
* @note None.
*/
static void xportedge_clear_app_buf ( void );
/**
* @brief XPort EDGE log application buffer.
* @details This function logs data from application buffer to USB UART.
* @note None.
*/
static void xportedge_log_app_buf ( void );
/**
* @brief XPort EDGE data reading function.
* @details This function reads data from device and concatenates data to application buffer.
* @param[in] ctx : Click context object.
* See #xportedge_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 xportedge_process ( xportedge_t *ctx );
/**
* @brief XPort EDGE 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 #xportedge_t object definition for detailed explanation.
* @return @li @c 0 - OK response.
* @li @c -2 - Timeout error.
* See #err_t definition for detailed explanation.
* @note None.
*/
static err_t xportedge_read_response ( xportedge_t *ctx );
void application_init ( void )
{
log_cfg_t log_cfg; /**< Logger config object. */
xportedge_cfg_t xportedge_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.
xportedge_cfg_setup( &xportedge_cfg );
XPORTEDGE_MAP_MIKROBUS( xportedge_cfg, MIKROBUS_1 );
if ( UART_ERROR == xportedge_init( &xportedge, &xportedge_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
log_printf( &logger, "*** Reset Device ***" );
xportedge_reset_device ( &xportedge );
xportedge_read_response ( &xportedge );
log_printf( &logger, "\r\n-----------------------------\r\n" );
log_printf( &logger, "*** Get Device Info ***" );
xportedge_send_enter ( &xportedge );
xportedge_read_response ( &xportedge );
xportedge_send_cmd ( &xportedge, XPORTEDGE_CMD_STATUS );
xportedge_read_response ( &xportedge );
xportedge_send_cmd ( &xportedge, XPORTEDGE_CMD_STATUS_DEVICE );
xportedge_read_response ( &xportedge );
xportedge_send_cmd ( &xportedge, XPORTEDGE_CMD_SHOW );
xportedge_read_response ( &xportedge );
log_printf( &logger, "\r\n-----------------------------\r\n" );
log_printf( &logger, "*** Go Back to Status Level ***" );
xportedge_send_enter ( &xportedge );
xportedge_read_response ( &xportedge );
xportedge_send_cmd ( &xportedge, XPORTEDGE_CMD_EXIT );
xportedge_read_response ( &xportedge );
log_printf( &logger, "\r\n-----------------------------\r\n" );
log_printf( &logger, "*** Get Interface Status and IP Address ***\r\n" );
log_printf( &logger, "*** Connect to Listed IP Address Through Web Browser to Access Web Interface ***" );
xportedge_send_enter ( &xportedge );
xportedge_read_response ( &xportedge );
xportedge_send_cmd ( &xportedge, XPORTEDGE_CMD_STATUS_INTERFACE_ETH0 );
xportedge_read_response ( &xportedge );
xportedge_send_cmd ( &xportedge, XPORTEDGE_CMD_SHOW );
xportedge_read_response ( &xportedge );
log_printf( &logger, "\r\n-----------------------------\r\n" );
log_printf( &logger, "*** Go Back to Status Level ***" );
xportedge_send_enter ( &xportedge );
xportedge_read_response ( &xportedge );
xportedge_send_cmd ( &xportedge, XPORTEDGE_CMD_EXIT );
xportedge_read_response ( &xportedge );
log_printf( &logger, "\r\n-----------------------------\r\n" );
log_printf( &logger, "*** Ping %s ***", ( char * ) ADDRESS_TO_PING );
xportedge_send_enter ( &xportedge );
xportedge_read_response ( &xportedge );
xportedge_send_cmd ( &xportedge, XPORTEDGE_CMD_STATUS_DIAGNOSTICS );
xportedge_read_response ( &xportedge );
xportedge_send_cmd ( &xportedge, XPORTEDGE_CMD_STATUS_DIAGNOSTICS_PING );
xportedge_read_response ( &xportedge );
xportedge_send_cmd ( &xportedge, XPORTEDGE_CMD_STATUS_DIAGNOSTICS_PING_HOST( ADDRESS_TO_PING ) );
xportedge_read_response ( &xportedge );
log_printf( &logger, "\r\n-----------------------------\r\n" );
log_printf( &logger, "*** Go Back to ROOT Level ***" );
xportedge_send_enter ( &xportedge );
xportedge_read_response ( &xportedge );
xportedge_send_cmd ( &xportedge, XPORTEDGE_CMD_EXIT );
xportedge_read_response ( &xportedge );
xportedge_send_cmd ( &xportedge, XPORTEDGE_CMD_EXIT );
xportedge_read_response ( &xportedge );
xportedge_send_cmd ( &xportedge, XPORTEDGE_CMD_EXIT );
xportedge_read_response ( &xportedge );
log_printf( &logger, "\r\n-----------------------------\r\n" );
log_printf( &logger, "*** List ROOT Level Commands and Switch to CLI Terminal ***\r\n" );
log_printf( &logger, "*** Now CLI Commands are Input from the UART Terminal ***" );
xportedge_send_enter ( &xportedge );
xportedge_read_response ( &xportedge );
xportedge_list_commands ( &xportedge );
xportedge_read_response ( &xportedge );
}
void application_task ( void )
{
app_buf_len = uart_read( &logger.uart, app_buf, PROCESS_BUFFER_SIZE );
if ( app_buf_len > 0 )
{
uart_write ( &xportedge.uart, app_buf, app_buf_len );
xportedge_clear_app_buf ( );
}
app_buf_len = uart_read( &xportedge.uart, app_buf, PROCESS_BUFFER_SIZE );
if ( app_buf_len > 0 )
{
uart_write ( &logger.uart, app_buf, app_buf_len );
xportedge_clear_app_buf ( );
}
}
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 xportedge_clear_app_buf ( void )
{
memset( app_buf, 0, app_buf_len );
app_buf_len = 0;
}
static void xportedge_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 xportedge_process ( xportedge_t *ctx )
{
uint8_t rx_buf[ PROCESS_BUFFER_SIZE ] = { 0 };
int32_t overflow_bytes = 0;
int32_t rx_cnt = 0;
int32_t rx_size = xportedge_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;
for ( int32_t buf_cnt = 0; buf_cnt < overflow_bytes; buf_cnt++ )
{
log_printf( &logger, "%c", app_buf[ buf_cnt ] );
}
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 XPORTEDGE_OK;
}
return XPORTEDGE_ERROR;
}
static err_t xportedge_read_response ( xportedge_t *ctx )
{
uint32_t timeout_cnt = 0;
uint32_t timeout = 30000;
while ( 0 == strstr( app_buf, XPORTEDGE_CMD_TERMINAL ) )
{
xportedge_clear_app_buf ( );
xportedge_process( ctx );
xportedge_log_app_buf ( );
if ( timeout_cnt++ > timeout )
{
return XPORTEDGE_ERROR_TIMEOUT;
}
Delay_ms ( 1 );
}
timeout_cnt = 0;
timeout = 100;
xportedge_clear_app_buf ( );
while ( timeout_cnt++ < timeout )
{
if ( XPORTEDGE_OK == xportedge_process( ctx ) )
{
timeout_cnt = 0;
}
xportedge_log_app_buf ( );
xportedge_clear_app_buf ( );
Delay_ms ( 1 );
}
return XPORTEDGE_OK;
}
// ------------------------------------------------------------------------ END
额外支持
资源
类别:Ethernet


































