現(xiàn)在現(xiàn)象就是當(dāng)我初始化完成之后,獲取到DHCP分配的地址,然后連接tcp,發(fā)送間隔為500ms發(fā)送一次,每次發(fā)送記錄的當(dāng)前數(shù)值,每次發(fā)送大概十分鐘的數(shù)據(jù),就會顯示進(jìn)入phy中斷,我寫的代碼就會自動重新連接,這是什么情況,一直解決不掉。
void?ch395q__init() { ????ch395q.status?=?init; ????CH395Q_Reset(); /*獲取芯片版本*/ while((ch395_version?=?CH395CMDGET_IC_VER())?!=?0x47) { print_log("CH395CMDGetVer?ERR\r\n"); HAL_Delay(100); } //測試命令,按位取反返回說明測試通過 while(CH395CMDCheckExist(0x55)?==?0xaa) { print_log("\r\nCH395CMDCheck?OK\r\n"); break; } //初始化模塊:成功返回?0? while(!CH395CMDInitCH395()) { print_log("\r\nCH395CMDInitCH395?OK\r\n"); break; } osDelay(200); print_log("\r\nstart\r\n"); ???? ????while(1)?{ ???????? ???????? ????????osDelay(50); ????????if(ch395q.status?==?getipsuccess)?{ ????????????ch395q.status?=?conneting; ????????????break; ????????} ???? ????} ????SetTCP_MQTT(); ???? ????CH395UdpSendBuf((uint8_t*)"join?success222222222222222222222222222222",50,0); ????ch395q.sendSatatus?=?sendRead; ????ch395q.status?=?conent; ????uint8_t?testsad[10]; ????uint16_t?testnumnum?=?0; ???? ????while(1)?{ ??????? ????????if(ch395q.status?==?conent)?{? ????????????if(ch395q.sendSatatus?==?sendsuccess)?{ ????????????????ch395q.sendSatatus?=?sendRead; ????????????} ????????????if(ch395q.sendSatatus?==?sendRead)?{ ????????????????ch395q.sendSatatus?=?sending; ????????????????testnumnum++; ????????????????int?length?=?sprintf((char?*)testsad,?"%d",?testnumnum);?//?格式化字符串 ????????????????CH395UdpSendBuf(testsad,length,0);???????/*?發(fā)送的時候要加一個判斷,發(fā)送完成上一包才能發(fā)送這一包?*/ ????????????} ????????}?else?{ ????????????break; ????????} ? ????????osDelay(500); ????} ???? }