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.

Need to check for Internet connectivity for EK-TM4C1294NCPDT using TI-RTOS

Hi,

I have tried tcpEcho example for TM4C1294NCPDT and was able to get the IP address. It waits if Ethernet link is down.

But once IP address is assigned and than Ethernet link becomes down, it does not change to "Network Removed". Can you please help me how to detect this?

Also My requirement is to check full connectivity between Board and Server (lets say Weather server used in enet_io example). Lets say From Board to router connectivity is there and board has IP address, but Internet link is down from Router to server. How to know status of this?

Using CCSv 6.0.1.00040 on Windows 8.1 64-bit. TI-RTOS version is 2_10_01_38.

Found some bugs in CCSv6.1 for httpd server so currently not planning to migrate.This is required as I have to send POST and GET request to the server. Its like I have to combine enet_io and enet_weather examples and migrate this code to TI-RTOS.

Thanks,
Bhavesh

  • Hi Bhavesh,

    I think we have an example that would meet your requirements. In TI-RTOS for TivaC 2.12.01.33, we have added an HTTP Client example that gets weather information from openweathermap.org server.

    The example has a hook function - netIPAddrHook defined which is configured as hook to the networkIPAddr() (see .cfg file). This function will be called whenever a network IP has been added or removed (the parameter 'fAdd' is set when IP is added) which I believe is what you are looking for.

    Hope this helps.

    Vikram

  • Hi Vikram,

    I installed TI-RTOS version as mentioned above.

    When I tried to open project from tirtos_tivac -> resources -> ek_tm4c1294xl -> tiTargetExmples -> ethernetExamples. I am getting error as mentioned in below screenshot.

    Also I downloaded TI-RTOS for Tiva C plugin from CCS App center earlier that is also removed when I installed new version for TI-RTOS manually. Can you please let me know how to import examples?

    Using CCSv6.0, due to finding some bugs in CCSv6.1 so can not migrate to new CCS version.

    Thanks,

    Bhavesh

  • Bhavesh,

    It looks like either your CCS and/or TI-RTOS installation got corrupted when you tried installing TI-RTOS. Did you delete/move any files in these products? I would recommend you to re-install CCS and install TI-RTOS for TivaC from the CCS AppCenter.

    Vikram
  • Hi Vikram,

    I was able to somehow get CCS working with TI-RTOS after 3-4 re-installation.

    Now I looked in to netIPAddrHook() function, As I mentioned earlier, It waits until IP is not assigned.

    I have added else condition in netIPAddrHook(), but it is not going in that condition if Ethernet cable is removed from board or Router is switched off.

    My test cases for network connectivity are following :

    - If LAN/Ethernet cable is removed from the board or Swith/Router is turned off means no Physical connection to net.

    - Board is connected to Router and after some time Router modifies the IP address for the board, in this case board has to modify this IP address.

    - Board is connected to Router and have IP address but Internet link from Router and Internet Service Provider is down.

    will netIPAddrHook() be able to identify and handle all this test cases?

    Thanks,

    Bhavesh

  • Hi Bhavesh,

    I think the second case will be handled by the dhcp client running on the device. After the lease period, the dhcp client will request an IP from the dhcp server on router. if the router provides an alternate IP, then the dhcp client will update the IP of the device accordingly. Also, In such cases the netIPAddrHook() will be called.

    Regarding the other two cases, it looks like the you need some kind of a feedback from the link layer (which is handled by the EMAC driver). I am not sure if we such a feature currently. I will check with our NDK expert and will update you if we have such a feature.

    Vikram

  • Hi Vikram,

    Unfortunately again the error started coming for CCSv6.0 and migrated to CCSv6.1 for time being to use with TI-RTOS. And ran the HTTP GET example and it is working. 

    After IP is assigned, will DHCP stops refreshing the IP address?

    For the HTTP GET example I added all Network Hooks. Code is attached for the same. But when Ethernet Cable is removed before HTTP request is successful, Networks Status Hook is not changing. So if DHCP is running at some interval than it should get the IP as null or 0x0 or 0xFFFFFFFF if cable is not connected and keep on searching, which is happening first time before IP is assigned.

    For other two I will be waiting for the reply.

    Thanks,

    Bhavesh

    4405.httpget_TivaTM4C1294NCPDT.zip

  • Hi Bhavesh,

    Yes, the IP Address Hook is called by the DHCP task only when there is a change in IP address . So, in your case after the initial IP address assignment it looks like there was no change in IP address. Hence no callback.

    I checked with the experts for the other two cases.

    Case 1: To check if the link is up or down

    You can directly call the EMAC_isLinkUp() in ti/drivers/EMAC.h. Would this help?

    If you need a more sophisticated interrupt based approach, then NDK has features that would allow you an interrupt based approach. But it requires modifying the EMAC driver to setup NDK Event signals and rebuilding the library. I have not tried the steps with TM4C1294XL board but if you would like to try it you can find further details about the NDK Events in NDK User Guide: section “4.2.4 Tracking Events with STKEVENT”. The sources for EMAC driver is provided ti/drivers//EMAC and you can find driver rebuild details in TI-RTOS User Guide.

    Case 3:

    I am not sure if there is a clean way that the network stack can signal the application of ISP being down. Even on PCs, when the ISP is down the error message will be "connection lost" or "network not found" or something like that.

    Can you provide us an example of a device or network stack that  supports this feature?

    Vikram

  • Hi Vikram,

    Thanks for the reply and clearing out queries.

    - For DHCP, yes IP address was not changed, but still want to know that DHCP server is running and it is trying to ping the Router to get the IP address. How to check this?

    Case 1: Have not checked the EMAC in much detail but this may help. In Tiva C series examples for enet_weather and enet_io, which uses LWIP for Network, events are there in EnetEvents() which executes callback If physical connection status is changed. I think EMAC_isLinkUp() does the same. Will update after checking. 

    Case 3: Even I do not have idea about any NDK or Network stack supporting this. But in Windows AFAIK they do periodic ping to some external server. If that is successful than it means Link is up or else based on the status 'Connection Lost' or 'Network Not Found; status are created. In our case while we do HTTPCli_connect() what it return as a status for these conditions?

    Also this link status check and HTTP Requests should be executed at some regular interval so I have to create timer tasks and execute them. Because currently it is executing in Network Hooks, so I think I have to create Timer Tasks and execute them after Network Hooks are executed. Please let me know if this is not ideal way to achieve functionality.

    Thanks,

    Bhavesh

  • Hi Bhavesh,

    Case 3: In case of HTTPCli_connect(), connection to the server fails and the return error code would either be HTTPCli_ECONNECTFAIL or HTTPCli_EPROXYTUNNELFAIL. HTTPCli_EPROXYTUNNELFAIL would occur if application is connecting to the server through proxy.

    As previously mentioned, you can setup the callback mechanism in the EMAC driver. Or if you would like to periodically check, then either Timer or Clock instances can be created. You can learn about Timers and Clocks in Section 5: Timing Services in TI-RTOS Kernel User Guide.

    Vikram

  • Dear Bhavesh,

    I have also almost same requirement as yours have you succeeded with your test cases?

    in your code we can only see the IP status on console, I have to check the full board to server communication so that i can see the text message on server end (socket test or Hercules) when i type it onto console of CCS or stallaris virtual port (UART port)  please guide me so that i can check the full board to server communication.

    I am using your code  httpget_TivaTM4C1294NCPDT please help me according to my requirements.

  • Hi Avinish,


    Unfortunately after trying it for 1 month we stopped working on this.

    Somehow we were able to get things done for receiving data from server and was able to handle some exceptions. But after doing socket operations for like 5 min code was hanging and that was just doing GET operations no other REST API calls or other operations.

    For Tiva boards we went for FreeRTOS and was able to achieve some of functionalities but still not fully operational. We started looking for Linux operated boards and working on some Prototypes right now.

    Thanks,
    Bhavesh