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.

MSP432E401Y: Can't get static IP to work in lwIP

Part Number: MSP432E401Y
Other Parts Discussed in Thread: MSP-EXP432E401Y

Hello, using the MSP-EXP432E401Y dev kit, I imported  into my workspace this example:

http://dev.ti.com/tirex/#/?link=Software%2FSimpleLink%20MSP432E4%20SDK%2FExamples%2FDevelopment%20Tools%2FMSP432E401Y%20LaunchPad%2FlwIP%2Fethernet_with_lwip

The code works fine when I use DHCP. However, when I try to use a statip IP, it fails.

In the file enet_lwip.c I change this line:

lwIPInit(g_ui32SysClock, pui8MACArray, 0, 0, 0, IPADDR_USE_DHCP);

to this:

ip4_addr_t local;
ip4_addr_t netmask;
ip4_addr_t gateway;


IP4_ADDR(&local,   192, 168, 1  ,19);
IP4_ADDR(&netmask, 255, 255, 255,0);
IP4_ADDR(&gateway, 192, 168, 1  ,1);

lwIPInit(g_ui32SysClock, pui8MACArray, local.addr, netmask.addr, gateway.addr, IPADDR_USE_STATIC);

with no sucess. I'm using the latest version of the SimpleLink SDK(2.40.00.11)

Any help would be appreciated.

Thanks,

Richard

  • Hello Richard,

    I will try it out and get back by tomorrow.

    Thanks,
    Sai
  • Hello Richard,

    In addition to the changes that you made, the following are required to enable Static IP Address allocation.

    In lwipopts.h file define the following labels to '0' as shown below

    #define LWIP_DHCP                       0           // default is 0
    #define LWIP_AUTOIP                     0           // default is 0

    Ideally this should be enough but there is a bug in lwiplib.c file due to which build errors are generated with the above code. I will file a bug so that it's fixed in the future releases. For now add the following line to lwiplib.c file at the end of all the other includes.

    #include "lwip/etharp.h"

    Also note that the way IP address is provided to the lwIPInit API is inverted. The IP address should be provided as follows:

    IP4_ADDR(&local, 19, 1, 168, 192);
    IP4_ADDR(&netmask, 0, 255, 255, 255);
    IP4_ADDR(&gateway, 1, 1, 168  ,192);

    Thanks,

    Sai

  • Sai Reddy, that solved the problem. Thank you!

**Attention** This is a public forum