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/EK-TM4C1294XL: enet_tcpecho_server with static IP

Part Number: EK-TM4C1294XL

Tool/software: Code Composer Studio

I have seen this post;

Which I have followed, but I am unable to replicate as SocketTest times out when set the example code to use a static IP. My 1st question is that you state to change

lwIPInit(g_ui32SysClock, pui8MACArray, 0, 0, 0, IPADDR_USE_DHCP);
CHANGE TO 
lwIPInit(g_ui32SysClock, pui8MACArray, 0xc0a8017e, 0xffffff00, 0, IPADDR_USE_STATIC);

Then when you show the socket test window the static address is 192.168.254.67, this is not 0xc0a8017e which is instead 192.168.1.126

My 2nd question is that I assume my subnet address will remain the same for static addressing as it was for dhcp (255.255.0.0)? 

And 3rdly do I need to change my network connection settings on my PC to talk to a server with a static IP?

Thanks

  • Hi,

      

    Hairy Lee said:

    Then when you show the socket test window the static address is 192.168.254.67, this is not 0xc0a8017e which is instead 192.168.1.126

     I think it is a mistake or mis-typing in the post you referred. The static address you enter in the SocketTest must match the address you enter in the LwIPInit(). Suppose the static address you want is 192.168.254.67 then you can enter like below. Again, make sure your PC is in the same subnet as the MCU device. I also assume you have set both the LWIP_DHCP and LWIP_AUTOIP to zero in the lwipopts.h file. 

    In lwipopts.h file:

    #define LWIP_DHCP 0

    #define LWIP_AUTOIP 0

     

    In enet_tcpecho_server.c file:

     lwIPInit(g_ui32SysClock, pui8MACArray,
                 (192 << 24) | (168 << 16) | (254 << 8) | 67,
                 (255 << 24) | (255 << 16) | (0 << 8) | 0,
                 (255 << 24) | (255 << 16) | (0 << 8) | 0,
                 IPADDR_USE_STATIC);
    Hairy Lee said:

    My 2nd question is that I assume my subnet address will remain the same for static addressing as it was for dhcp (255.255.0.0)? 

    That should be fine. If you had tested the DHCP and the address that was given to you was in the same subnet then it should work. As a matter of fact, I will suggest you first run the DHCP version of the example to find out the IP address that is leased to you. You can use this address as your static address for testing purpose as this address will be unique until the address is expired.
    Hairy Lee said:

    And 3rdly do I need to change my network connection settings on my PC to talk to a server with a static IP?

    No, I don't think so. If you followed the previous two notes then it should work. On your PC, you can do a "ping" command to the MCU first. 
  • Thank you Charles,

    I thought it was probably a typo, but just wanted to check.

    The suggestion to use the IP address reported by the DHCP version has enabled me to make a connection. I hadn't realised that I could use this, all the examples for static ip that I have seen start with 192. which is not what the IP address I had been leased started with so I made a incorrect assumption.

    Regards,

    HL