Skip to main content
NMach.1
Associate
Sep 23, 2021 12:59 PM UTC
Question

I have an STM32H742VGT based project with ethernet connection (LAN8742AI-CZ phy ) the problem is that I get HAL_ERROR when the HAL_StatusTypeDef HAL_ETH_Transmit(ETH_HandleTypeDef *heth, ETH_TxPacketConfig *pTxConfig, uint32_t Timeout)

When the HAL_ETH_Transmit is called by the driver it seems the code below (part of HAL_ETH_Transmit ) times out as the DMA TX complete callback are not called. I've followed the STM32H743 example but I guess STM32H742 memory map is a bit different than H743. Does anyone tries Ethernet on STM32H742 ?

Thanks

The timeout error

  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;

    /* Set ETH HAL State to Ready */

    heth->gState = HAL_ETH_STATE_ERROR;

    /* 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;

     heth->gState = HAL_ETH_STATE_ERROR;

     return HAL_ERROR;

    }

   }

  }

This topic has been closed for replies.

9 replies

Pavel A.
Sep 23, 2021 9:11 PM UTC

The project is for *F*742 and you run it on *H*742?

Really?

NMach.1
NMach.1Author
Associate
Sep 24, 2021 10:29 AM UTC

Sorry, bad Copy and past, it is STM32H742VGT, I've fixed the

original post.

clock.1166
Senior
Sep 24, 2021 10:36 AM UTC

Hi - The problem maybe timer related or memory location (.ld). There is a good series of videos by controllertech on you tube regarding this.

It helped me to get my STM32H743ZI2 going!

NMach.1
NMach.1Author
Associate
Sep 29, 2021 4:42 AM UTC

Hi clock.1166

Thanks for your answer, could you please give more info about the timer

Thanks

clock.1166
Senior
Sep 29, 2021 6:19 AM UTC

There are many videos available. I found the it best to start with this one:

https://controllerstech.com/stm32-ethernet-1-connection/

or

https://www.youtube.com/watch?v=MJfUiw8bZEI - memory management

Its best that you look at all the relevant videos in the series.

He explains and uses Timer6 instead of the preset timertick.

This is also handy:

https://community.st.com/s/article/FAQ-Ethernet-not-working-on-STM32H7x3

I am only starting to understand all this myself - its a long haul.

Piranha
Principal III
Sep 29, 2021 3:51 PM UTC

Honestly, that site and videos are as bad as HAL/Cube code itself. The guy has a shallow understanding and the code doesn't fix any real issues.

https://youtu.be/8r8w6mgSn1A?t=1082

The thing doesn't work... "Let me reset it once!" :D

The reality is that on H7 networking code of HAL/Cube basically doesn't work and it cannot be fixed with clicking CubeMX. Look here for more details:

https://community.st.com/s/question/0D50X0000C6eNNSSQ2/bug-fixes-stm32h7-ethernet

https://community.st.com/s/question/0D50X0000BOtfhnSQB/how-to-make-ethernet-and-lwip-working-on-stm32

clock.1166
Senior
Sep 30, 2021 9:24 AM UTC

As I said, I am only just learning about webservers.

These videos helped me understand a bit more and also how to get the project working OK on STM32H743ZI2.

Some of us need a simple explanation!

Or even a shallow understanding!

Pavel A.
Sep 30, 2021 9:42 AM UTC

TX timeout error can be because of disconnected cable or phy error.

This is my shallow understanding. Check the error value returned by the ETH driver or define callbacks for errors.

Associate
Jul 27, 2024 6:58 AM UTC

hey  can u help me to configure stm32h742 im trying from last one month even till now it is not connected with lan can you please let me know the mpu config and the rx and tx decripter and heap address please help me