STM32F7 lwIP Ethernet [FreeRTOS] - TxPktSemaphore not given
I'm developing a device that works as a modbus slave over TCP/IP. For this application I'm using FreeRTOS with CMSIS-v1 and LwIP. The problem occurs sometimes when I disconnect the master (a PC with modbus poll), then the code stucks waiting for a semaphore (TxPktSemaphore) inside the function low_level_output() on ethernetif.c
Here is the part of the code where the ejecution keeps waiting forever a semaphore (line 8).
TxConfig.Length = p->tot_len;
TxConfig.TxBuffer = Txbuffer;
TxConfig.pData = p;
pbuf_ref(p);
HAL_ETH_Transmit_IT(&heth, &TxConfig);
while(osSemaphoreWait(TxPktSemaphore, TIME_WAITING_FOR_INPUT)!=osOK)
{
}
HAL_ETH_ReleaseTxPacket(&heth);
return errval;In addition, I attach a wireshark capture when the master (10.8.51.2) request the end of the connection and the problem doesn´t occur:
But when the problem occasionally occurs, there is a RST:
Please consider in both captures that I have more than one connection at the same time between master and slave, that's the reason there is activity after the desconnection (belongs to other ports
).
Thanks in advance.
