AnsweredAssumed Answered

STM32F7 Discovery - lwIP problem

Question asked by DJK on Oct 11, 2016
Latest reply on Oct 12, 2016 by DJK
I am using the STM32F7 discovery as a HTTP server with lwip and FreeRTOS. It is able to receive and respond to the HTTP requests without any issue until it attempts to respond to the 19th request where it takes close to 2 minutes to respond. The responses to the requests are sent by using "netconn_write()".

I have found that it is getting stuck in the function "sys_timeouts_mbox_fetch" in lwip_timers.c where "goto again" is leaving it in a loop. I believe this is part of the TCP/IP thread

Any idea as to how and why this is happening and how to fix it would be helpful.
sys_timeouts_mbox_fetch(sys_mbox_t *mbox, void **msg)
  u32_t time_needed;
  struct sys_timeo *tmptimeout;
  sys_timeout_handler handler;
  void *arg;
 again:   //constantly looping here
  if (!next_timeout) {
    time_needed = sys_arch_mbox_fetch(mbox, msg, 0);
  } else {
    if (next_timeout->time > 0) {
      time_needed = sys_arch_mbox_fetch(mbox, msg, next_timeout->time);
    } else {
      time_needed = SYS_ARCH_TIMEOUT;
    if (time_needed == SYS_ARCH_TIMEOUT) {
      /* If time == SYS_ARCH_TIMEOUT, a timeout occured before a message
         could be fetched. We should now call the timeout handler and
         deallocate the memory allocated for the timeout. */
      tmptimeout = next_timeout;
      next_timeout = tmptimeout->next;
      handler = tmptimeout->h;
      arg = tmptimeout->arg;
      if (handler != NULL) {
        LWIP_DEBUGF(TIMERS_DEBUG, ("stmf calling h=%s arg=%p\n",
          tmptimeout->handler_name, arg));
      memp_free(MEMP_SYS_TIMEOUT, tmptimeout);
      if (handler != NULL) {
        /* For LWIP_TCPIP_CORE_LOCKING, lock the core before calling the
           timeout handler function. */
      /* We try again to fetch a message from the mbox. */
      goto again;
    } else {
      /* If time != SYS_ARCH_TIMEOUT, a message was received before the timeout
         occured. The time variable is set to the number of
         milliseconds we waited for the message. */
      if (time_needed < next_timeout->time) {
        next_timeout->time -= time_needed;
      } else {
        next_timeout->time = 0;