cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H743 LwIP no RTOS transmit in interrupt

Vale81
Associate II

Hi, 

I'm using STM32H743 with STM32Cube FW_H7 V1.12.1 library package.

I'm using LwIP without RTOS and our application is working well. In order to improve performance we would like to use the transmission in interrupt for the etherrnet interface instead the polling transmission.

I saw that in the ethernet_link_check_state function in ethernetif.c file it is used the  HAL_ETH_Start_IT(&heth), but in the low_level_output used to transmit data is used HAL_ETH_Transmit() insted of HAL_ETH_Transmit_IT().

Is it possible to use the HAL_ETH_Transmit_IT() in order to improve performance?

What we need to modify in order to use the HAL_ETH_Transmit_IT() insted of HAL_ETH_Transmit()?

Thanks in advance.

Regards

5 REPLIES 5
MOBEJ
ST Employee

Hello @Vale81 , 

Switching to HAL_ETH_Transmit_IT() improves efficiency by leveraging interrupts and non-blocking behavior but requires proper interrupt setup and callback handling in your application.

Br

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
Vale81
Associate II

Hi, thank you very much for your fast response!!

Can you help me to understand how setup the interrupt and how to manage the HAL_ETH_TxCpltCallback() callback? I didn't found an example of application without RTOS, I tried to use the HAL_ETH_Transmit_IT() and manage the HAL_ETH_TxCpltCallback() but in a wrong way because after some transmissions the application go in HardFault for a non proper managemente of buffers (I think).

Thanks in advance

Regards

Vale

Hello , 

An example without RTOS for NUCLEO-H723ZG is available on GitHub: LwIP_TCP_Echo_Server and LwIP_UDP_Echo_Server. You can check and adpt them to your board and application.

 

Br

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
Vale81
Associate II

Hi,

I verify the example you sent me but they are the same as the one from I started LwIP_TCP_Echo_Server for STM32H743I-EVAL. The problem is that in my ethernetif.c file in the function ethernet_link_check_state is used the HAL_ETH_Start_IT(&heth); (Enables Ethernet MAC and DMA reception/transmission in Interrupt mode), but in the same file in the function low_level_output to send data is used HAL_ETH_Transmit(&heth, &TxConfig, ETH_DMA_TRANSMIT_TIMEOUT); . This is a blocking transmission, I'm not able to use the HAL_ETH_Transmit_IT() instead of  HAL_ETH_Transmit() in low_level_output. I check the difference between HAL_ETH_Transmit_IT() and HAL_ETH_Transmit() in my stm32h7xx_hal_eth.c and the only difference is a while loop: 

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/* Wait for data to be transmitted or timeout occurred */

while ((dmatxdesc->DESC3 & ETH_DMATXNDESCWBF_OWN) != (uint32_t)RESET)

{

if ((heth->Instance->DMACSR & ETH_DMACSR_FBE) != (uint32_t)RESET)

{

heth->ErrorCode |= HAL_ETH_ERROR_DMA;

heth->DMAErrorCode = heth->Instance->DMACSR;

/* Return function status */

return HAL_ERROR;

}

 

/* Check for the Timeout */

if (Timeout != HAL_MAX_DELAY)

{

if (((HAL_GetTick() - tickstart) > Timeout) || (Timeout == 0U))

{

heth->ErrorCode |= HAL_ETH_ERROR_TIMEOUT;

/* Clear TX descriptor so that we can proceed */

dmatxdesc->DESC3 = (ETH_DMATXNDESCWBF_FD | ETH_DMATXNDESCWBF_LD);

return HAL_ERROR;

}

}

}

///////////////////////////////////////////////////////////////////////////

I would like to use the HAL_ETH_Transmit_IT() because this whle loop take a lot of time for our application, about 1.2ms.

In all examples I checked I always found the  low_level_output() with the blocking HAL_ETH_Transmit(), also in the example you suggest me.

Can you help me to understand if it is possible to use theHAL_ETH_Transmit_IT() and how, without RTOS?

I send you attached my ethernetif.c and stm32h7xx_hal_eth.c.

 

Thanks in advance

 

Regards

 

Vale

 

Vale81
Associate II

Hi,

has anyone ever used transmission in interrupt in LwIP without RTOS?

Is it possible to do that without semaphores?

Thanks in advance

Regards