AnsweredAssumed Answered

Problem with the LwIP TCP/IP stack

Question asked by ronan on May 21, 2012
Hi,

I use LwIP TCP/IP stack demonstration for STM32F407/STM32F417 microcontrollers that I configured to work with my STM32F4 discovery board.

I tested the TCP/UDP echo server application based on netconn API (Application running with the FreeRTOS ) and I have a problem.

static void udpecho_thread(void *arg)
{
  err_t err;
   
  LWIP_UNUSED_ARG(arg);
 
   conn = netconn_new(NETCONN_UDP);
  if (conn!= NULL)
  {
    err = netconn_bind(conn, IP_ADDR_ANY, 7);
    if (err == ERR_OK)
    {
      while (1)
      {
        buf = netconn_recv(conn);
       
        if (buf!= NULL)
        {
          addr = netbuf_fromaddr(buf);
          port = netbuf_fromport(buf);
          netconn_connect(conn, addr, port);
          buf->addr = NULL;
          netconn_send(conn,buf);
          netbuf_delete(buf);
        }
      }
    }
    else
    {
      printf("can not bind netconn");
    }
  }
  else
  {
    printf("can create new UDP netconn");
  }
}

At first, the board correctly returns the first 4 frames received and then it loses the udp network. When I debugged I realized that the program remains blocked in the function
buf = netconn_recv(conn) but I don't know why ??

I supposed that this function takes a semaphore each time it receives a udp frame and after a time it can not take the semaphore but why !!!!

If anyone has had this problem thank you for his help.

Ronan.

Outcomes