cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F7 Discovery - lwIP problem

davidjonas-king
Associate
Posted on October 11, 2016 at 15:19

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. Thanks.

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 LWIP_DEBUG_TIMERNAMES
if (handler != NULL) {
LWIP_DEBUGF(TIMERS_DEBUG, (''stmf calling h=%s arg=%p\n'',
tmptimeout->handler_name, arg));
}
#endif /* LWIP_DEBUG_TIMERNAMES */
memp_free(MEMP_SYS_TIMEOUT, tmptimeout);
if (handler != NULL) {
/* For LWIP_TCPIP_CORE_LOCKING, lock the core before calling the
timeout handler function. */
LOCK_TCPIP_CORE();
handler(arg);
UNLOCK_TCPIP_CORE();
}
LWIP_TCPIP_THREAD_ALIVE();
/* 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;
}
}
}
}

#stm32f746-disco #lwip #freertos
1 REPLY 1
davidjonas-king
Associate
Posted on October 12, 2016 at 09:31

It seems that by increasing the value of ''#define MEM_SIZE'' (lwipopts.h) solved it.