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.

Start communicate via Ethernet - EK-TM4C1294

I am a starter embedded programmer.

I want to create communication between the controller (EK-TM4C1294) and computer via Ethernet.

I tried to use in examples enet_io and enet_lwip, but I could not understand them how to communicate easily between a terminal and controller (without using an HTTP server).

How can I start?

  • Hello Uriel,

    Ques: What is that you are communicating?

    First of all you need IP address to be assigned to the 2 devices. For that your network must have DHCP if dynamic IP allocation is being done. Or if there is no dynamic IP allocation, then static IP allocation must be done for which the subnet address must allow for the IP address assigned statically.

    Secondly, In TCP, there is a server-client model. So one of the device must be a server for the communication application and another a client. If the PC is the server, then you may want to write a Server application which the EK-TM4C1294 can connect to.

    In essence, lets see what the Ques gets answered as.

    Regards
    Amit
  • Hello Amit,

    I tried to run enet_uip example, and changed it to run with static ip:

    #define USE_STATIC_IP
    
    #ifndef DEFAULT_IPADDR0
    #define DEFAULT_IPADDR0         192
    #endif
    
    #ifndef DEFAULT_IPADDR1
    #define DEFAULT_IPADDR1         168
    #endif
    
    #ifndef DEFAULT_IPADDR2
    #define DEFAULT_IPADDR2         16
    #endif
    
    #ifndef DEFAULT_IPADDR3
    #define DEFAULT_IPADDR3         94
    #endif
    
    #ifndef DEFAULT_NETMASK0
    #define DEFAULT_NETMASK0        255
    #endif
    
    #ifndef DEFAULT_NETMASK1
    #define DEFAULT_NETMASK1        255
    #endif
    
    #ifndef DEFAULT_NETMASK2
    #define DEFAULT_NETMASK2        255
    #endif
    
    #ifndef DEFAULT_NETMASK3
    #define DEFAULT_NETMASK3        0
    #endif
    

    But I have some problems:

    1. When the debugger arrived to the next rows:

    #ifdef USE_STATIC_IP
        uip_ipaddr(sIPAddr, DEFAULT_IPADDR0, DEFAULT_IPADDR1, DEFAULT_IPADDR2,
                   DEFAULT_IPADDR3);
        uip_sethostaddr(sIPAddr);
        ShowIPAddress(sIPAddr);
        uip_ipaddr(sIPAddr, DEFAULT_NETMASK0, DEFAULT_NETMASK1, DEFAULT_NETMASK2,
                   DEFAULT_NETMASK3);
        uip_setnetmask(sIPAddr);

    the debugger stuck at ShowIPAddress.

    if I remark this row, the debugger stuck at the following rows:

    #ifndef USE_STATIC_IP
    //
    // Initialize the DHCP Client Application.
    //
    dhcpc_init(&sTempAddr.addr[0], 6);
    dhcpc_request();
    #endif

    2. Further to the previous question, how can I communicate with the computer via Ethernet using an hyper terminal?

    Thanks,

    Uriel

  • Hello Uriel,

    Do you have a Wireshark trace that shows that the static address being presented by the client is being accepted by the DHCP server?

    Regards
    Amit
  • Hello Amit,

    I haven't Wireshark, but before I defined static ip, the DHCP server provided this ip to the controller.

    Uriel

  • Hello Uriel

    Normally DHCP does provide the IP Address but it also provides for the Subnet Mask. I would ask you to see what Wireshark is showing up during Static IP to see if the issue is due to mis-managed protocol or something else. If the DHCP goes w/o any issue if REQ-ACK, then we need to see what the next issue is in the dhcpc_request process.

    Regards
    Amit
  • Hello Amit,

    The Subnet Mask is also the one that was provided by the DHCP server.

    Uriel

  • Hello Uriel,

    I think it would be good to bring up the Wireshark logs to debug the issue

    Regards
    Amit
  • Hello Amit.
    I installed wireshark. What i need to do to get these logs?
  • Hello Uriel,

    First select the interface on the PC where the Ethernet connection is going to be established. Please note if the connection is via a Switch then you need to have a managed switch so that the Wireshark can capture packets on the ethernet interface it will snoop.

    Regards
    Amit