Part Number: AM3359
Other Parts Discussed in Thread: TLK110
Hi everyone,
I am trying to write a baremetal C code for ethernet on AM3359 ICE V2 board for. I am trying to use Ethernet1
interface(J1 port), set J19 so as to select RMII mode, CPSWPinMuxSetup_Ind() and PortModeSelect_Ind() also selecting RMII mode.
I am able to get clock on MDIO clock pin and read and write phy TLK110 registers using MDIO interface. But when LWIP stack is
initialized, It says unable to add interface for interface 0, Port 1 IP Address Acquisition Failed. This happens in both the cases:
whether STAIC or DHCP. Can somebody tell me what is going wrong. Or if someone has written any such code please help me out.
I don't have to use RTOS, OS etc. I am using am335x_platform and starterware provided in ind sdk package.
My main code is copied below:
int main(void)
{
unsigned int ipAddr;
LWIP_IF lwipIfPort1, lwipIfPort2;
MMUConfigAndEnable();
#ifdef LWIP_CACHE_ENABLED
CacheEnable(CACHE_ALL);
#endif
CPSWPinMuxSetup_Ind();
UTILsInitCpswIcssPorts(CPSW_SWITCH);
CPSWClkEnable();
MDIOInit(SOC_CPSW_MDIO_REGS,50,5);
MDIOPhyAutoMDIXEnable(SOC_CPSW_MDIO_REGS,3);
PortModeSelect_Ind();
RMIIClock_setup();
/* Set up the UART peripheral for Standard Input/Output operation.*/
UARTStdioInit();
// /* Chip configuration RGMII selection */
// EVMPortRGMIIModeSelect();
/* Get the MAC address */
EVMMACAddrGet(1, lwipIfPort1.macArray);
// EVMMACAddrGet(1, lwipIfPort2.macArray);
AintcCPSWIntrSetUp();
DelayTimerSetup();
UARTPuts("StarterWare Ethernet Echo Application. \n\r\n\r" , -1);
UARTPuts("Acquiring IP Address for Port 1... \n\r" , -1);
#if STATIC_IP_ADDRESS_PORT1
lwipIfPort1.instNum = 0;
lwipIfPort1.slvPortNum = 1;
lwipIfPort1.ipAddr = STATIC_IP_ADDRESS_PORT1;
lwipIfPort1.netMask = 0;
lwipIfPort1.gwAddr = 0;
lwipIfPort1.ipMode = IPADDR_USE_STATIC;
ipAddr = lwIPInit(&lwipIfPort1);
#else
lwipIfPort1.instNum = 0;
lwipIfPort1.slvPortNum = 1;
lwipIfPort1.ipAddr = 0;
lwipIfPort1.netMask = 0;
lwipIfPort1.gwAddr = 0;
lwipIfPort1.ipMode = IPADDR_USE_DHCP;
ipAddr = lwIPInit(&lwipIfPort1);
#endif
if(ipAddr)
{
UARTPuts("\n\r\n\rPort 1 IP Address Assigned: ", -1);
IpAddrDisplay(ipAddr);
}
else
{
UARTPuts("\n\r\n\rPort 1 IP Address Acquisition Failed.", -1);
}
/* Initialize the sample httpd server. */
echo_init();
/* Loop forever. All the work is done in interrupt handlers. */
while(1)
{
; /* Perform nothing */
}
return 0;
}
pelase help me as soon as possible