2025-05-22 12:30 AM
I am connecting a TCP/IP stack to the HAL_ETH driver of an STM32F7xx. I am using https://github.com/STMicroelectronics/STM32CubeF7/blob/master/Projects/STM32F767ZI-Nucleo/Applications/LwIP/LwIP_HTTP_Server_Netconn_RTOS/Src/ethernetif.c as a starting point.
I see that low_level_output() calls HAL_ETH_ReleaseTxPacket() only if the ethernet driver runs out of DMA descriptors:
do
{
if(HAL_ETH_Transmit_IT(&EthHandle, &TxConfig) == HAL_OK)
{
errval = ERR_OK;
}
else
{
if(HAL_ETH_GetError(&EthHandle) & HAL_ETH_ERROR_BUSY)
{
/* Wait for descriptors to become available */
osSemaphoreWait( TxPktSemaphore, ETHIF_TX_TIMEOUT);
HAL_ETH_ReleaseTxPacket(&EthHandle);
errval = ERR_BUF;
}
else
{
/* Other error */
pbuf_free(p);
errval = ERR_IF;
}
}
}while(errval == ERR_BUF);
It seems like HAL_ETH_ReleaseTxPacket() will then deallocate all completed buffers and block if none of the scheduled buffers has been completed yet. So far so good. But: