在初始化CH579網(wǎng)絡(luò)時(shí),出現(xiàn)程序卡死情況。代碼如下
void SysInit(void)
{
??? PWR_UnitModCfg(ENABLE, UNIT_SYS_PLL);
??? DelayMs(3);
??? PWR_UnitModCfg(ENABLE, UNIT_ETH_PHY);
??? DelayMs(3);
??? SetSysClock(CLK_SOURCE_HSE_32MHz);
??? SysTick_Config(32000);
??? DebugInit();
}
void UdpInit(void)
{
??? int i = 0;
??? uint8_t MACAddr[6];
??? printf("Network version:%x\n", WCHNET_GetVer());
??? if ( WCHNET_LIB_VER != WCHNET_GetVer()) {
??????? printf("version error.\n");
??? }
??? i = ETH_LibInit(IP, GW, MASK, MAC);????????? //Ethernet library initialize
??? if (i == WCHNET_ERR_SUCCESS)
??????? printf("WCHNET_LibInit Success\r\n");
??? WCHNET_CreateUdpSocket();
}
#define WCHNET_LIB_VER????????????????? 0x16????????????? //the library version number
在調(diào)用到WCHNET_GetVer()時(shí)程序停止。開發(fā)工具用的MounRiver , 庫版本0x16