实验 TivaWare_C_Series-2.1.4.178\examples\boards\dk-tm4c129x\enet_lwip 例程中初始化了液晶和图形库,我仅仅搭建了最小系统,在初始化液晶的过程中会进Fault ISR ,为啥? 例程是dhcp获取ip的,我把网线插到无限路由器扔获取不到ip ROM_FlashUserGet(&ui32User0, &ui32User1);
if((ui32User0 == 0xffffffff) || (ui32User1 == 0xffffffff))
{
while(1)
{代码会一直死在这}
} 把这段代码屏蔽,修改为静态ip pui8MACArray[0] = 2;
pui8MACArray[1] = 0;
pui8MACArray[2] = 0;
pui8MACArray[3] = 1;
pui8MACArray[4] = 2;
pui8MACArray[5] = 3;//伪造mac地址 ipaddr=inet_addr("192.168.1.33");
netmask=inet_addr("255.255.255.0");
gw=inet_addr("192.168.1.1"); lwIPInit(g_ui32SysClock, pui8MACArray, ipaddr, netmask, gw, IPADDR_USE_STATIC); LocatorInit();// 在这里创建udp,绑定本地ip,端口23
LocatorMACAddrSet(pui8MACArray);
LocatorAppTitleSet("DK-TM4C129X enet_lwip"); httpd_init();//网页服务器 ROM_IntPrioritySet(INT_EMAC0, ETHERNET_INT_PRIORITY);
ROM_IntPrioritySet(FAULT_SYSTICK, SYSTICK_INT_PRIORITY); 到这里网络就算初始化完了。下载代码 在网络共享中心发现了本地连接,但是ping这个ip是没有任何响应的,不知为何 while(1)
{
ui32NewIPAddress = lwIPLocalIPAddrGet();
UARTprintf("ip:%d,%d,%d,%d\r\n",addr[3]=(ui32NewIPAddress >> 24) & 0xff,
addr[2]=(ui32NewIPAddress >> 16) & 0xff,
addr[1]=(ui32NewIPAddress >> 8) & 0xff,
addr[0]= ui32NewIPAddress & 0xff);
ROM_GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_6, GPIO_PIN_6);
ROM_SysCtlDelay(10000000);
ROM_GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_6, 0);
ROM_SysCtlDelay(10000000);
} 我一直打印ip地址,刚上电的时候ip全是255,过几秒ip就一直是0了~~~
|