在初始化CH579网络时,出现程序卡死情况。代码如下
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
在调用到WCHNET_GetVer()时程序停止。开发工具用的MounRiver , 库版本0x16