本人最近在学习enet_io这个例程,可是程序下到板子里一直ping不通,由于没用lm3s8962的开发板,是自己焊的一块lm3s69911的板子,所以外围电路不一样,但以太网口都是一样的,所以我感觉应该是能ping通的,那些功能实现不了又是另外一码事,可是就是ping不通,请问是什么原因啊?我在主程序中将其已改成静态ip了,是不是哪个函数还要做简单修改?这个例程中只要哪个函数能顺利执行,就能实现和电脑的通讯,web能控制?
int
main(void)
{
// unsigned long ulUser0, ulUser1;
// unsigned char pucMACArray[8];
unsigned long ulIPAddr=0xC0A80619,ulNetMask=0xFFFFFF00,ulGWAddr=0xC0A80601;
const unsigned char pucMACArray[] ={0X00,0x14,0x97,0xF0,0x00,0x01};
/****hmm************************/
#if PLL_EN == 0 /* Not use PLL 不使用PLL */
SysCtlClockSet(CCLK_DIV | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | EXT_CLK);
/* System clock= */
/* EXT_CLK/CCLK_DIV */
/* 系统时钟=EXT_CLK/CCLK_DIV */
#else /* Use PLL 使用PLL */
SysCtlClockSet(CCLK_DIV | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | EXT_CLK);
/* System clock=200MHz/CCLK_DIV*/
/* 系统时钟=200MHz/CCLK_DIV */
#endif
/********hmm**************/
//
// Set the clocking to run directly from the crystal.
//
/*
SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN |
SYSCTL_XTAL_8MHZ);
*/
//
// Initialize the OLED display.
//
RIT128x96x4Init(1000000);
// RIT128x96x4StringDraw("Web-Based I/O Control", 0, 0, 15);
// RIT128x96x4StringDraw("Browser Message:", 0, 53, 15);
//
// Enable and Reset the Ethernet Controller.
//
SysCtlPeripheralEnable(SYSCTL_PERIPH_ETH);
SysCtlPeripheralReset(SYSCTL_PERIPH_ETH);
//
// Enable Port F for Ethernet LEDs.
// LED0 Bit 3 Output
// LED1 Bit 2 Output
//
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
GPIOPinTypeEthernetLED(GPIO_PORTF_BASE, GPIO_PIN_2 | GPIO_PIN_3);
//
// Configure SysTick for a periodic interrupt.
//
SysTickPeriodSet(SysCtlClockGet() / SYSTICKHZ);
SysTickEnable();
SysTickIntEnable();
//
// Enable processor interrupts.
//
IntMasterEnable();
//
// Configure the hardware MAC address for Ethernet Controller filtering of
// incoming packets.
//
// For the LM3S6965 Evaluation Kit, the MAC address will be stored in the
// non-volatile USER0 and USER1 registers. These registers can be read
// using the FlashUserGet function, as illustrated below.
//
/*
FlashUserGet(&ulUser0, &ulUser1);
if((ulUser0 == 0xffffffff) || (ulUser1 == 0xffffffff))
{
//
// We should never get here. This is an error if the MAC address
// has not been programmed into the device. Exit the program.
//
RIT128x96x4StringDraw("MAC Address", 0, 16, 15);
RIT128x96x4StringDraw("Not Programmed!", 0, 24, 15);
while(1);
}
//
// Convert the 24/24 split MAC address from NV ram into a 32/16 split
// MAC address needed to program the hardware registers, then program
// the MAC address into the Ethernet Controller registers.
//
pucMACArray[0] = ((ulUser0 >> 0) & 0xff);
pucMACArray[1] = ((ulUser0 >> 8) & 0xff);
pucMACArray[2] = ((ulUser0 >> 16) & 0xff);
pucMACArray[3] = ((ulUser1 >> 0) & 0xff);
pucMACArray[4] = ((ulUser1 >> 8) & 0xff);
pucMACArray[5] = ((ulUser1 >> 16) & 0xff);
*/
//
// Initialze the lwIP library, using DHCP.
//
//lwIPInit(pucMACArray, 0, 0, 0, IPADDR_USE_DHCP);
lwIPInit(pucMACArray,ulIPAddr, ulNetMask, ulGWAddr, IPADDR_USE_STATIC);
//
// Setup the device locator service.
//
/*
LocatorInit();
LocatorMACAddrSet(pucMACArray);
LocatorAppTitleSet("EK-LM3S8962 enet_io");
*/
//
// Initialize a sample httpd server.
//
httpd_init();
/*********hmm****/
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
GPIODirModeSet(GPIO_PORTE_BASE, SYS, GPIO_DIR_MODE_OUT); /* 设置连接sys收发指示灯PE5为输出 */
GPIOPadConfigSet(GPIO_PORTE_BASE, SYS, /* 设置驱动强度和类型 */
GPIO_STRENGTH_4MA, /* 4mA的输出驱动强度 */
GPIO_PIN_TYPE_STD); /* 设置为推挽管脚 */
GPIOPinWrite(GPIO_PORTE_BASE, SYS, ~SYS);
/******HMM*****/
//
// Pass our tag information to the HTTP server.
//
http_set_ssi_handler(SSIHandler, g_pcConfigSSITags,
NUM_CONFIG_SSI_TAGS);
//
// Pass our CGI handlers to the HTTP server.
//
http_set_cgi_handlers(g_psConfigCGIURIs, NUM_CONFIG_CGI_URIS);
//
// Initialize IO controls
//
io_init();
//
// Loop forever. All the work is done in interrupt handlers.
//
while(1)
{
}
}
上面是主程序,其余未做修改
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
网口通讯?反正是ping不通,但是8962和6911的网口的引脚不是一样吗,所以应该没问题,但就是ping不通。
一周热门 更多>