加入星計(jì)劃,您可以享受以下權(quán)益:

  • 創(chuàng)作內(nèi)容快速變現(xiàn)
  • 行業(yè)影響力擴(kuò)散
  • 作品版權(quán)保護(hù)
  • 300W+ 專業(yè)用戶
  • 1.5W+ 優(yōu)質(zhì)創(chuàng)作者
  • 5000+ 長(zhǎng)期合作伙伴
立即加入
  • 正文
  • 推薦器件
  • 相關(guān)推薦
  • 電子產(chǎn)業(yè)圖譜
申請(qǐng)入駐 產(chǎn)業(yè)圖譜

RT1176千兆以太網(wǎng)速率測(cè)試

05/19 10:25
3662
閱讀需 7 分鐘
加入交流群
掃碼加入
獲取工程師必備禮包
參與熱點(diǎn)資訊討論

NXP針對(duì)以太網(wǎng)的操作提供了相當(dāng)齊全的例程。主要是freertos加lwip的方案,很經(jīng)典也很好用。

今天筆者就簡(jiǎn)單測(cè)一下RT1176板卡的千兆以太網(wǎng)速率。這里使用的例程是SDK_2_10_0_MIMXRT1170-EVKboardsevkmimxrt1170lwip_exampleslwip_iperfbmcm7mdk。

iperf是是一個(gè)網(wǎng)絡(luò)性能測(cè)試工具。Iperf可以測(cè)試最大TCPUDP帶寬性能,具有多種參數(shù)和UDP特性,可以根據(jù)需要調(diào)整,可以報(bào)告帶寬、延遲抖動(dòng)和數(shù)據(jù)包丟失。

可以在下面的代碼里面配置默認(rèn)的ip地址、掩碼、網(wǎng)關(guān)。

/* 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

設(shè)備接線

串口打印,這里筆者選擇了1模式,測(cè)試TCP的RX速率

上位機(jī)顯示,測(cè)試時(shí)間為60s

最終速率達(dá)到了253Mbit/s,對(duì)于一個(gè)單片機(jī)來(lái)說(shuō)可以說(shuō)相當(dāng)驚人了。

之后筆者測(cè)試了freertos的tcp服務(wù)器的RX速度。不對(duì)接收到的數(shù)據(jù)做任何處理

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,這里估計(jì)是NXP并沒(méi)有對(duì)其代碼做優(yōu)化,有時(shí)間可以繼續(xù)試一下。

推薦器件

更多器件
器件型號(hào) 數(shù)量 器件廠商 器件描述 數(shù)據(jù)手冊(cè) ECAD模型 風(fēng)險(xiǎn)等級(jí) 參考價(jià)格 更多信息
NRF52840-QIAA-R7 1 Nordic Semiconductor Telecom Circuit, 1-Func, PBGA73, AQFN-73
$7.48 查看
CM7V-T1A-LOW-ESR-32.768KHZ-7PF-20-TA-QC 1 Micro Crystal AG Parallel - Fundamental Quartz Crystal,

ECAD模型

下載ECAD模型
$3.02 查看
AT27C512R-45JU-T 1 Microchip Technology Inc OTP ROM, 64KX8, 45ns, CMOS, PQCC32

ECAD模型

下載ECAD模型
$2.23 查看

相關(guān)推薦

電子產(chǎn)業(yè)圖譜