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.

RTOS/EK-TM4C129EXL: RTOS/HTTP example with static ip

Part Number: EK-TM4C129EXL


Tool/software: TI-RTOS

Hello,

i have TI-RTOS v2.16.1.14 on my ek-tm4c129exl board.

When i add the http example to my project and start it, all things works fine and i get a response from www.example.com.

In this case i get an ip from dhcp protocol.But when i change the dhcp settings to static ip settings, i get an error:

Error! code = -106, desc = httpTask: address resolution failed

Why does the http example work only with the dhcp settings ?

  • Hi Mark,

    Can you ping the TM4C from your laptop? Is the static IP address valid for the network it is on? What was the IP address, subnet and gateway when you use DHCP? What settings are you using for the static case?

    Todd
  • Hi,
    I have implemented a local http server as described in the document "Making http Server". I start the program with DHCP I get the IP 192.168.1.154 assigned. If I now change the connection settings to static ip (IP: 192.168.1.154, subnet: 255.255.255.0, gateway: 192.168.1.1) the local server will also work and send a html page to the browser.

    But if I import the httpget_EK_TM4C129EXL_TI_TivaTM4C129ENCPDT to send data to an external server, then this example only works with the DHCP settings. If I change these settings to static IP I get the error:
    Error! code = -106, desc = httpTask: address resolution failed
    In the DHCP case the IP is 192.168.1.154 and in the static case the IP is 192.168.1.154, Subnetmask is 255.255.255.0, Gateway is 192.168.1.1
    I can also ping in the static case the set IP.

    Only with DHCP settings does the httpget_EK_TM4C129EXL_TI_TivaTM4C129ENCPDT project work.

  • Hi Mark,

    To do an external name host name resolution (as the httpget examples does ) when your device is setup with a static IP address you also need to provide an external DNS address. DHCP gives you an external DNS server address automatically, so that's why the example works with DHCP.

    To setup up an external DNS address you should use the following code:

    uint32_t ip = inet_addr("8.8.8.8");
    
    if (ip) {
        CfgAddEntry(0, CFGTAG_SYSINFO, CFGITEM_DHCP_DOMAINNAMESERVER,
            0, sizeof(IPAddr), (unsigned char *)&ip, 0);
    }

    Place this before your call to connect() so that the DNS server is added before that call. Also replace the address in the "ip" variable with whatever DNS server you want to use.

    Regards,

    Dalton

  • Many Thanks.
    Now both types of communication are working