Tx Buffer Descriptors Semaphore Leak?

Hello, I am running into a very unexpected issue on a custom board with a SAME70 microcontroller running FreeRTOS and FreeRTOS-Plus. The microcontroller is in constant communication with the PC sending and receiving real-time data. I am sending data at about a 1500 Hz rate and receiving data at about 500 Hz and the processing time for the data is very small as well, all very manageable.

After running for a few seconds up to 15 minutes, the transmit portion of the TCP/IP stack comes down because there aren’t any xTXDescriptorSemaphore left. I found this out by looking at the global diagnostic variable tx_release_count and noticed that tx_release_count[3] keeps incrementing after a while.

Looking around, the only information I found on tx_release_count is here (I posted my question a couple of days ago but that thread is a few years old).

I was able to modify my ASF libraries to work with the FreeRTOS-Plus-TCP DriverSAM library which includes: gmac_SAM.c, gmac_SAM.h, and NetworkInterface.c. I mention this because that is where tx_release_count[3]++ is happening, nowhere else except here. I tried tracing the descriptor but it’s very difficult because everything will run as expected for some amount of time before buffer descriptors start getting lost(?) and eventually there’s none left.

Once it gets to this state, I am still able to receieve data, process it, and when I go to send it, this is where the data gets lost and never makes it to the GMAC driver.

Anyone has any ideas why these semaphores are getting lost somewhere? It’s like when the stack is overwhelmed or getting close to full capacity buffer descriptors don’t get released. I’m at a loss here. Any input is very much appreciated. Thanks.

Hi, what version of FreeRTOS and FreeRTOS-Plus-TCP are you using?

@archigup FreeRTOS V10.4.6 and FreeRTOS+TCP V2.4.0

Since you suspect stack overflow, have your turned on the feature to crash upon stack overflow occurring? If not, that can be a good place to start FreeRTOS - stacks and stack overflow checking

Make sure also that you are able to see crashes.

Hi, I am not suspecting stack overflow, it’s a semaphore leak for the Tx buffer descriptors. Once all of the semaphores are gone, my application is still running as it should. The light’s blinking, DAC and ADC are being read/written to, and I’m even processing UDP packets. FreeRTOS goes through the whole motion of sending them back, they just never make it out.

There are a couple people actively responding on this other post though.