?CH32V307內(nèi)置PHY,使用RT Thread? 系統(tǒng),其它全部采用默認(rèn)配置,主任務(wù)只有一個(gè)以太網(wǎng)任務(wù),不管是只接收、只發(fā)送、回傳,數(shù)據(jù)量大了(接近滿速)后,幾秒或幾十秒后就死機(jī)。
請(qǐng)幫忙分析是什么問題,謝謝。
代碼: while(1) ????{ ????????rt_thread_delay(500);???//*?wait?eth?phy?enable ????????host?=?(struct?hostent*)gethostbyname(url); ????????serveraddr.sin_family?=?AF_INET; ????????serveraddr.sin_port?=?htons(port); ????????serveraddr.sin_addr?=?*((struct??in_addr?*)host->h_addr); ????????rt_memset(&(serveraddr.sin_zero),?0,?sizeof(serveraddr.sin_zero)); ????????if((sock=socket(AF_INET,SOCK_STREAM,0))?==?-1) ????????{ ????????????rt_kprintf("Socket?error?sock=%d\n",sock); ????????????break; ????????} ????????if?(connect(sock,?(struct?sockaddr?*)&serveraddr,?sizeof(struct?sockaddr))?==?-1) ????????{ ????????????rt_kprintf("Connect?fail!\n"); ????????????closesocket(sock); ????????????continue; ????????} ????????else ????????{ ????????????rt_kprintf("Connect?sock_%d??successful\n",sock); ????????} ????????while(1) ????????{ ????????????/*bytes_received?=?recv(sock,?rx_buffer,?sizeof(rx_buffer)?-?1,?0); ????????????if?(bytes_received?<?0) ????????????{ ????????????????//?receive?timeout,?continue?the?receiving?of?next?socket ????????????????break; ????????????} ????????????else?{ ????????????????rx_buffer[bytes_received]?=?0; ????????????}*/ ???????????//int?err?=?send(sock,?rx_buffer,?strlen(rx_buffer),?0); ????????????int?err?=?send(sock,?rx_buffer,?100,?0); ????????????//rt_thread_mdelay(100); ????????????if?(err?<?0)?{ ????????????????rt_kprintf("Error?occurred?during?sending:?errno?%?.\r\n",?err); ????????????????rt_kprintf("Shutting?down?socket?and?restarting..."); ???????????????//?shutdown(sock,?0); ????????????????closesocket(sock); ????????????????rt_thread_mdelay(1000); ????????????????break; ????????????} ????????} ????} 打印信息,但經(jīng)常不完整。 ?\?|?/ -?RT?-?????Thread?Operating?System ?/?|?\?????4.0.4?build?Mar?25?2022 ?2006?-?2021?Copyright?by?rt-thread?team lwIP-2.1.2?initialized! MCU:?CH32V307 SysClk:?144000000Hz msh?>Connect?fail! Connect?fail! Connect?sock_0??successful state! Assertion:?1836?in?../rt-thread/components/net/lwip-2.1.2/src/api/api_msg.c,?thread?etx ?hardfult mepc:0bd3fca8 mcause:00000001 mtval:0bd3fca8
LWIP 配置
測速速度