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/TM4C129ENCPDT: TI Board to Board Communication

Part Number: TM4C129ENCPDT


Tool/software: Code Composer Studio

I am using two  EK - TM4C 129EXL Evaluation Kits with Code Composer Studio to establish Board to Board communication (string data transfer) using Ethernet TCP/IP lwip protocol.

For that, I had to configure One board as a server and other as Client. I planned to write two separate programs for the server and client and check that using Labview by communicating with PC and then connect them together for the board to board communication.

I have checked - TI board as a server and my PC(Labview) as the client by modifying the "enet_lwip.c" example program and it works fine. It was already written for TI board as the server.

Now I am trying to make my TI board as a client and check using PC(LabView) as server.

I call the Ethernet_Init() function and if the connection is established, the call back function "connected" will be called.

void Ethernet_Init(void)
{

struct tcp_pcb *pcb;
err_t err;
pcb = tcp_new();
if(pcb == NULL)
{
UARTprintf("Cannot create pcb\n");
}

ip_addr_t ip2;
ip2.addr=3232236043;  // decimal value corresponding to 192.168.2.11 (my TI board IP address set using lwipinit() function)

tcp_bind(pcb, &ip2, 30001); // port is 30001

ip_addr_t ip1;
ip1.addr=3232236044;  // decimal value corresponding to 192.168.2.12 - my PC IP address


err = tcp_connect(pcb,&ip1,30001,connected); //30001 is the port number, "connected" is the call back function that needs to be called

if(err == ERR_VAL || err ==ERR_RTE || err == ERR_OK)  // ERR_OK is returned from tcp_connect function
{
     UARTprintf("err returned\n");
}

}

static  err_t  connected (void *arg, struct tcp_pcb *pcb, err_t err )
{
  tcp_write(pcb,"OK",2,0);
  return 1;
}

Though I get ERR_OK from the tcp_connect() the "connected" function is not getting called and in the Labiew side I'll have tcp_listen (server) function which keeps on waiting until a client gets connected to it.

And my board is not getting connected to it.

Am I missing something or is there any other way to establish a microcontroller board to board communication through ethernet.

Thank You for your time.

  • I think your IP address is the problem. When you bind you should use something like:
    tcp_bind(pcb, IP_ADDR_ANY, 30001);

    When you connect to the server you should do:
    err = tcp_connect(pcb,&ip2,30001,connected); // the ip2 is your PC IP address, not your TI board address. I will suggest you use a different port number like 30002. The server port doesn't need to be the same port as the client
  • Sorry. I made a mistake in the question. The 192.168.2.11 is my TI board IP and 192.168.2.12 is my PC IP. I have edited the post.
    Sorry once again..

    I have checked with IP_ADDR_ANY. It is not working. Is there any example program that configures TI board as client?
    Thank You.
  • Hi,
    Can you show your code entire code such as the connected callback and other callbacks for receive? Please also use the wireshark to capture the Ethernet frames. You should see the the client sending a SYNC=0 segment to the server. If successful, the server is supposed to reply a SYNC ACK frame.
  • Hi,
    Is the problem resolved? I will close the thread for now and if you have further question you can open this thread or create a new thread.