This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

ICE v2 + lwip + enetlwip sample not working ?

Other Parts Discussed in Thread: AM3359, SYSBIOS

Dear all,

I have tried to load the Ethernet LWIP sample on my ICE v2 evaluation board (from TI Industrial SDK 1.1.0.3). Has anyone succeeded running the sample ? Here is the debug output I get from the UART console:

TI Industrial SDK Version - IASDK 1.1.0.3

Device name : AM3359
Chip Revision : AM335x ES1.2 [PG2.1]
ARM Clock rate : 600
SYS/BIOS enetLwip Sample application running on ICE V2
Acquiring IP Address for Port 1
Port 1 IP Address Acquisition Failed.

I should mention J18 and J19 are properly configured to CPSW (Pin 1 and 2 are shorted). 

I have tried to debug into the lwip stack and it looks like the network interface cannot be brought up.

I have tried on 2 different ICE v2 boards.

Thank you very much,

Romain Farkas

  • Hi Romain,
     
    The Industrial SDK is supported on the SYS/BIOS forum: http://e2e.ti.com/support/embedded/tirtos/default.aspx. For a faster reply try posting your question there too.
  • Romain Farkas,

    The LWIP example assigns a static IP address 192.168.1.2 to the application.

    Can you try executing the application with ETH0 connected to a machine with an IP address of same subnet?

    Regard,
    Vinesh

  • Hi Vinesh,

    I have tried that but it doesn't work. While debugging I have discovered lwIPInit fails; moreover, stepping in I can confirm that 

    netif_add(&cpswNetIF[ifNum], &ip_addr, &net_mask, &gw_addr,&cpswPortIf[ifNum], cpswif_init, tcpip_input))

    fails as well.

    So the network interface cannot be brought up.

    Best,

    Romain

  • Romain,

    There could be many reasons for failure of netif_add, but it is usually because MDIO Alive/Link register for the particular port is not set. 

    Are the Ethernet LEDs showing correct behavior on plugging/unplugging the port? 

    Regards,
    Vinesh

  • Dear Vinesh,

    The right-hand side LED turns orange (on/off) on plugging/unplugging the port. 

    The left-hand side LED blinks green whenever I ping the ICE2 from a workstation on the same subnet.

    With a protocol analyzer such as Wireshark I can confirm there is no reply from 192.168.1.2 on a ping request, which is normal as the network interface cannot be brought up.

    Romain

  • Romain,

    That is the desired behavior meaning the jumper settings should be correct. 

    I am not sure what's missing here, but can you recheck on these points?

    • The Jumper settings to configure ICEv2 for CPSW mode
    • Ethernet cable is plugged in(to Ethernet 0) at the start of execution
    • The end machine is in the same subnet

    Also, the prebuilt binaries for these applications are available here. Can you try loading the enetLwip application via SD card or by flashing it to SPI?

    Another way to do a hardware check is by using the ethernetip_adapter application.

    Regards,
    Vinesh

  • Hi Vinesh,

    Thank you, this solved my issue. It looks like it is mandatory to have the Ethernet cable plugged in to bring up the Ethernet interface. 

    Any idea why ?

    Thanks.

    Romain

  • Romain,

    Glad that you got it working.

    This example was ported from the starterware example, for which lwIPInit returns 0 if a link is not detected. As a result the IP address assigning fails and the application fails to come up.

    Regards,
    Vinesh

  • Hi,

    I am sorry to ask you the same question,
    even I am struck in exactly the same situation.

    The Jumper settings and the LED blinks seems OK but the UART output
    always says.

    Acquiring IP Address for Port 1
    Port 1 IP Address Acquisition Failed.

    Below is the Static IP address settings in the enetLwip.c of enetLwip_sysbios sample project.

    lwipIfPort1.instNum = 0;
    lwipIfPort1.slvPortNum = 1;
    lwipIfPort1.ipAddr = STATIC_IP_ADDRESS_PORT1; // 0xc0a80102(192.168.1.2)
    lwipIfPort1.netMask = 0xffffff00; //255.255.255.0
    lwipIfPort1.gwAddr = 0xc0a80101; //192.168.1.1
    lwipIfPort1.ipMode = IPADDR_USE_STATIC;

    And below is the IP address settings of my PC.

    IP address  192.168.1.3
    Subnet mask  255.255.255.0
    Default gateway  192.168.1.1

    Please let me know what else should be taken care to get the communication working.

    Regards
    Prad

  • Prad,

    Is the ethernet cable plugged in at the time of execution?

    Regards,
    Vinesh

  • Vinesh,

    Yes, the cable is plugged in at the time of execution,
    the jumper setting is changed to CPSW(Ethernet 0).

    Regards
    Prad

  • Prad,

    As I mentioned earlier, only a few things have to be taken care for executing this example.

    Can you provide more debug information? When the IP Address acquisition fails, it indicates lwIPInit fails. Can you try stepping into this and check what goes wrong?

    Regards,

    Vinesh

  • Hi Vinesh,

    Thank you so much for your time.

    Below is the debug information.

    The return value of the "ipAddr = lwIPInit(&lwipIfPort1);" from the enetLwip.c
    seems to be zero.


    I tried to step into lwIPInit() function and the execution ends at "return 0" point below.


    unsigned int lwIPInit(LWIP_IF *lwipIf)
    {

    ........

    ........

    #ifdef sys_bios_ind_sdk
    if(NULL ==
    netif_add(&cpswNetIF[ifNum], &ip_addr, &net_mask, &gw_addr,
    &cpswPortIf[ifNum], cpswif_init, tcpip_input))

    #else
    if(NULL ==
    netif_add(&cpswNetIF[ifNum], &ip_addr, &net_mask, &gw_addr,
    &cpswPortIf[ifNum], cpswif_init, ip_input))
    #endif
    {
    LWIP_PRINTF("\n\rUnable to add interface for interface %d", ifNum);
    return 0;
    }

    ..........

    ..........

    ipAddrPtr = (unsigned int*)&(cpswNetIF[ifNum].ip_addr);

    return (*ipAddrPtr);
    }

    And the "*ipAddrPtr" value is "0xFFFFFFFF".

    Regards
    Prad

  • Prad, 

    There can be many reasons for netif_add to return 0, but usually the issue is because the mdio is not able to detect a link. If you go further in, you can see that the MDIO checks for the "ALIVE" and "LINK" status. Can you please check if these values are getting reflected correctly?

    Regards,
    Vinesh

  • I've just had the same issue.

    In my case, problem is caused by MDIO interface hardwiring: 

    In ethernet configuration, only MDIO_CLK and MDIO_DATA should drive PRUETH_MDC and PRUETH_MDIO.

    But, if you run ethernet application through CCS debugger (and JTAG download cable), CPU configured PR1_MDIO_MDCLK  and PR1_MDIO_DATA according to preloaded ethercat application loaded by the bootloader *before* CCS debugger even connected to CPU:

    GEL init script does not disable PRU or its pinmux, so you get two output pins driving the same net.

    To avoid this, you should disconnect those two pins from PRU and configure as tristate, before any MDIO init in ethernet application (ie: enetLwip_sysbios):

    	GPIOInit();
        prot_mutex_hdl = GateMutex_create(NULL, NULL);    
    
    	CPSWPinMuxSetup_Ind();
    	
    	/*GPIO2_0 input: if PRU is still driving PR1_MDIO_MDCLK, override this  */
     	HWREG(SOC_CONTROL_REGS + CONTROL_CONF_GPMC_CLK) = 0x07;		// pinmux
     	HWREG(SOC_GPIO_2_REGS + 0x134) |= (1 << 0);					// input gpio2_0
    
     	/*GPIO2_1 input: if PRU is still driving PR1_MDIO_DATA, override this */
     	HWREG(SOC_CONTROL_REGS + CONTROL_CONF_GPMC_CSN(3)) = 0x07;	// pinmux
     	HWREG(SOC_GPIO_2_REGS + 0x134) |= (1 << 1);					// input gpio2_1
    
    	if(AM335X_BOARD_TYPE_ICE_V2 == boardType)
    		UTILsInitCpswIcssPorts(CPSW_SWITCH);
    	
        CPSWClkEnable();
    	
    	MDIOInit(SOC_CPSW_MDIO_REGS,400,5);