• 正文
  • 推荐器件
  • 相关推荐
申请入驻 产业图谱

RT1176千兆以太网速率测试

2024/05/19
4009
加入交流群
扫码加入
获取工程师必备礼包
参与热点资讯讨论

NXP针对以太网的操作提供了相当齐全的例程。主要是freertos加lwip的方案,很经典也很好用。

今天笔者就简单测一下RT1176板卡的千兆以太网速率。这里使用的例程是SDK_2_10_0_MIMXRT1170-EVKboardsevkmimxrt1170lwip_exampleslwip_iperfbmcm7mdk。

iperf是是一个网络性能测试工具。Iperf可以测试最大TCPUDP带宽性能,具有多种参数和UDP特性,可以根据需要调整,可以报告带宽、延迟抖动和数据包丢失。

可以在下面的代码里面配置默认的ip地址、掩码、网关。

/* IP address configuration. */
#define configIP_ADDR0 192
#define configIP_ADDR1 168
#define configIP_ADDR2 0
#define configIP_ADDR3 102

/* Netmask configuration. */
#define configNET_MASK0 255
#define configNET_MASK1 255
#define configNET_MASK2 255
#define configNET_MASK3 0

/* Gateway address configuration. */
#define configGW_ADDR0 192
#define configGW_ADDR1 168
#define configGW_ADDR2 0
#define configGW_ADDR3 100

设备接线

串口打印,这里笔者选择了1模式,测试TCP的RX速率

上位机显示,测试时间为60s

最终速率达到了253Mbit/s,对于一个单片机来说可以说相当惊人了。

之后笔者测试了freertos的tcp服务器的RX速度。不对接收到的数据做任何处理

static void
tcpecho_thread(void *arg)
{
struct netconn *conn, *newconn;
err_t err;
LWIP_UNUSED_ARG(arg);

/* Create a new connection identifier. */
/* Bind connection to well known port number 7. */
#if LWIP_IPV6
conn = netconn_new(NETCONN_TCP_IPV6);
netconn_bind(conn, IP6_ADDR_ANY, 7);
#else /* LWIP_IPV6 */
conn = netconn_new(NETCONN_TCP);
netconn_bind(conn, IP_ADDR_ANY, 7);
#endif /* LWIP_IPV6 */
LWIP_ERROR("tcpecho: invalid conn", (conn != NULL), return;);

/* Tell connection to go into listening mode. */
netconn_listen(conn);

while (1) {

/* Grab new connection. */
err = netconn_accept(conn, &newconn);
/*printf("accepted new connection %pn", newconn);*/
/* Process the new connection. */
if (err == ERR_OK) {
struct netbuf *buf;
void *data;
u16_t len;

while ((err = netconn_recv(newconn, &buf)) == ERR_OK) {
// /*printf("Recvedn");*/
// do {
// netbuf_data(buf, &data, &len);
// err = netconn_write(newconn, data, len, NETCONN_COPY);
//#if 0
// if (err != ERR_OK) {
// printf("tcpecho: netconn_write: error "%s"n", lwip_strerr(err));
// }
//#endif
// } while (netbuf_next(buf) >= 0);
netbuf_delete(buf);
}
/*printf("Got EOF, loopingn");*/
/* Close connection and discard connection identifier. */
netconn_close(newconn);
netconn_delete(newconn);
}
}
}

速度大约有45Mbit/s,这里估计是NXP并没有对其代码做优化,有时间可以继续试一下。

推荐器件

更多器件
器件型号 数量 器件厂商 器件描述 数据手册 ECAD模型 风险等级 参考价格 更多信息
TLP291(SE 1 Toshiba America Electronic Components Transistor Output Devices

ECAD模型

下载ECAD模型
$0.47 查看
ABM11AIG-40.000MHZ-4Z-T3 1 Abracon Corporation CRYSTAL 40MHZ 10PF SMD
$1.44 查看
TJA1055T/3/C,518 1 NXP Semiconductors TJA1055 - Enhanced fault-tolerant CAN transceiver SOIC 14-Pin

ECAD模型

下载ECAD模型
$1.64 查看
点赞1
收藏
评论
分享
加入交流群
举报

相关推荐

登录即可解锁
  • 海量技术文章
  • 设计资源下载
  • 产业链客户资源
  • 写文章/发需求
立即登录