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.

CCS/AM4379: An Example in Starterware called TCPecho doesn't work in Static IP mode.

Part Number: AM4379
Other Parts Discussed in Thread: SYSBIOS

Tool/software: Code Composer Studio

Hello!

The example is in sysbios_ind_sdk_2.1.0.1 SDK, and located in ...\sysbios_ind_sdk_2.1.0.1\sdk\starterware\examples\enet\tcpecho.

I changed code, and wanted to make it work in Static IP mode. However, after copying compiled app into the board,  it even didn't ping succussfully .

Part of code is as followed:

////////////////////////////////////////////////////////Start//////////////////////////////////////////////////////////////////

    LWIPInit();
    /* Get the list of Ethernet PHY devices. */
    pEnetPhyDeviceIdlist = ENETPhyGetDeviceIdList();

    if (TRUE == BOARDIsDevicePresent(pEnetPhyDeviceIdlist[devIndex]))
        {
            /* Ethernet PHY device found */
            devId = pEnetPhyDeviceIdlist[devIndex];
            noOfDev = BOARDGetNumDevices(pEnetPhyDeviceIdlist[devIndex]);
           
            for (idx = 0U; idx < noOfDev; idx++)
            {
                status = BOARDResetDevice(devId, idx);
                /* Get the control mod id for the current device */
                instNum = BOARDGetDeviceCtrlModInstNum(devId, idx);
                portNum = BOARDGetDeviceCtrlInfo(devId, idx);
                ifNum = (instNum * LWIP_CPSW_INST_PORT_MAX) + portNum - 1U;

                lwipIfPort[ifNum].modId = BOARDGetDeviceCtrlModId(devId, idx);
                lwipIfPort[ifNum].instNum = instNum;
                lwipIfPort[ifNum].portNum = portNum;
                lwipIfPort[ifNum].phyConfig.devId = devId;
                lwipIfPort[ifNum].phyConfig.devInst = idx;
                lwipIfPort[ifNum].phyConfig.phyAddr =
                    BOARDGetDeviceDataModId(devId, idx);

                /* Get the Ethernet PHY device data */
                pEnetPhyDeviceData = ENETPhyGetDeviceData(devId);
                lwipIfPort[ifNum].phyConfig.macType = pEnetPhyDeviceData->macType;
                lwipIfPort[ifNum].phyConfig.isGigCapab = pEnetPhyDeviceData->isGigCapab;

                CONSOLEUtilsPrintf("\n\rAcquiring IP Address for Port %d... ", portNum);

                lwipIfPort[ifNum].ipAddr = (192u<<24)|(168u<<16)|(100u<<8)|9u;
                lwipIfPort[ifNum].netMask = (255u<<24)|(255u<<16)|(255u<<8)|0u;
                lwipIfPort[ifNum].gwAddr = (192u<<24)|(168u<<16)|(100u<<8)|255u;
                lwipIfPort[ifNum].ipMode = IPADDR_USE_STATIC; //changed from IPADDR_USE_DHCP

                //status= LWIPAddNetIf(&lwipIfPort[ifNum]);

                if(S_PASS == LWIPAddNetIf(&lwipIfPort[ifNum]))
                    {
                    CONSOLEUtilsPrintf("\n\rPort %d IP Address Assigned: "
                        "%d.%d.%d.%d\n\r", portNum,
                        ((lwipIfPort[ifNum].ipAddr >> 24) & 0xFF),
                        ((lwipIfPort[ifNum].ipAddr >> 16) & 0xFF),
                        ((lwipIfPort[ifNum].ipAddr >> 8) & 0xFF),
                        (lwipIfPort[ifNum].ipAddr & 0xFF));
                    }
                else
                    {
                    CONSOLEUtilsPrintf("\n\rPort %d IP Address Acquisition Failed.\n\r", portNum);
                    }
            }
        }
        devIndex++;

    /* Initialize the sample tcp echo. */
    echo_init();


    /* Loop forever. */
    while(1U)
    {
        ;
    }

////////////////////////////////////////////////////////End//////////////////////////////////////////////////////////////////

Related macros were reconfigured:

#define LWIP_DHCP                       0//changed from 1
#define LWIP_AUTOIP                     0

The phenomenon is that right info will be printed through Serial Tool, but when I ping to it or use a client to visit it, an error 'not route to host' will come out.

So, I will appreciate it if someone will tell me how to solve it.

Thank you, :-).