|
刚在LMS3S9B81上调通了网络通讯功能,通讯功能一切正常,能ping,能打开里面的网页,PC网卡显示连接100M.美中不足的是网口的两个LED不亮,不知何故。 贴上初始化代码,使用了LM3S的库,请高手帮忙分析一下,
unsigned long nEthClk, ulTemp; SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ);// 系统时钟初始化
// Enable and Reset the Ethernet Controller. SysCtlPeripheralEnable(SYSCTL_PERIPH_ETH); SysCtlPeripheralReset(SYSCTL_PERIPH_ETH);
SysCtlPeripheralEnable (SYSCTL_PERIPH_GPIOF); GPIODirModeSet (GPIO_PORTF_BASE, (GPIO_PIN_2 | GPIO_PIN_3), GPIO_DIR_MODE_HW); GPIOPadConfigSet(GPIO_PORTF_BASE, (GPIO_PIN_2 | GPIO_PIN_3), GPIO_STRENGTH_4MA, GPIO_PIN_TYPE_STD);
// Intialize the Ethernet Controller and disable all Ethernet Controller // interrupt sources. EthernetIntDisable(ETH_BASE, (ETH_INT_PHY | ETH_INT_MDIO | ETH_INT_RXER | ETH_INT_RXOF | ETH_INT_TX | ETH_INT_TXER | ETH_INT_RX)); ulTemp = EthernetIntStatus(ETH_BASE, false); EthernetIntClear(ETH_BASE, ulTemp);
// Initialize the Ethernet controller for operation nEthClk = SysCtlClockGet(); EthernetInitExpClk(ETH_BASE, nEthClk);
// Configure the Ethernet controller for normal operation // Enable TX Duplex Mode // Enable TX Padding EthernetConfigSet(ETH_BASE, (ETH_CFG_TX_DPLXEN | ETH_CFG_TX_PADEN | ETH_CFG_TX_CRCEN));
HWREG(ETH_BASE + MAC_O_THR) = 0x0;
// Program the MAC Address EthernetMACAddrSet(ETH_BASE, nMACAddr);
// Enable the Ethernet controller EthernetEnable(ETH_BASE);
|
|