cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F407, LwIP, FreeRTOS socket - connect infinite loop in vPortRaiseBASEPRI

George Eliozov
Associate II
Posted on July 20, 2017 at 12:30

Hello everyone,

Testing LwIP + FreeRTOS on my devboard.

Everything configured by CubeMX.

each time I use 'connect' function I ends up in infinite loop inside vPortRaiseBASEPRI

I have strong feeling that has some correlation with interrupt priorities.

Additional information:

Ethernet - use RMII interface

SYS clocked from Timer 14...

Socket crated from main thread.

Thanks in advance

#freertos #stm32f407 #lwip
6 REPLIES 6
George Eliozov
Associate II
Posted on July 20, 2017 at 13:24

Update.

 Looks like it has some correlation with UART1 interrupts...

George Eliozov
Associate II
Posted on July 20, 2017 at 14:22

update.

manually (CubeMX does not allow to increase priority of USART interrupts) increased priority of USART1 IRQ from 5 to 4.

so far so good...

Posted on July 20, 2017 at 14:46

Hi

Rare to see someone that has exacly the same problem as me.Did that change solve your problem ? Whats weird is that I have the same problem but I don't have any UART enabled.Got any idea what it could be ?I only have ethernet , LwIP and Free RTOS enabled.

-Andy
Posted on July 20, 2017 at 15:10

Working so far. No deadlocks. Now I have issues with lwip timeouts ....

Receive never ends if other side didn't close a socket....

Posted on July 20, 2017 at 15:35

Well still trying to find which interrutp priority is wrong.Since I have no other peripherals enabled it shouldn't be too long (fingers crossed).I tried changing the ethernet priority but still got the same problem.

Posted on July 21, 2017 at 09:37

Also I removed the HAL IRQ handler for UART and wrote my own which use FIFO. This helps a lot !

The HAL has quite strange implementation of serial port data. Now I have 64 byte output cyclic buffer, which is more then enough for my serial text terminal.

Also enable in lwipopts.h

#define SOCKETS_DEBUG LWIP_DBG_ON

and try to use timeouts.

// Setup timeouts 
if(lwip_setsockopt(socket_fd,SOL_SOCKET,SO_RCVTIMEO,&rx_timeout,sizeof(tx_timeout)) <0){ 
lwip_close(socket_fd); 
printf('
Net, Failed to set timeouts
'); 
} 
 
if(lwip_setsockopt(socket_fd,SOL_SOCKET,SO_SNDTIMEO,&tx_timeout,sizeof(tx_timeout)) <0){ 
lwip_close(socket_fd); 
printf('
Net, Failed to set timeouts
'); 
} �?�?�?�?�?�?�?�?�?�?