Skip to main content
Visitor II
March 10, 2023
Question

STM32H747I with LWIP not working

  • March 10, 2023
  • 4 replies
  • 1481 views

Hello

I used the STM32H747-Disco development board and created a Keil project according to this link, https://community.st.com/s/article/How-to-create-project-for-STM32H7-with-Ethernet-and-LwIP -stack-working

My CubeMX is version 6.6, and the firmware package is version 1.10, but my Lwip can't work properly. During the debugging process, I found that there is a problem with the initialization part of Lan8742, and it returns a timeout problem LAN8742_STATUS_RESET_TIMEOUT

The problem is here lan8742.c :

      while(regvalue & LAN8742_BCR_SOFT_RESET)

      {

       if((pObj->IO.GetTick() - tickstart) <= LAN8742_SW_RESET_TO)

       {

        if(pObj->IO.ReadReg(pObj->DevAddr, LAN8742_BCR, &regvalue) < 0)

        { 

         status = LAN8742_STATUS_READ_ERROR;

         break;

        }

       }

       else

       {

        status = LAN8742_STATUS_RESET_TIMEOUT;

        break;

       }

      } 

Can someone help me please:loudly_crying_face:

    This topic has been closed for replies.

    4 replies

    Super User
    March 10, 2023

    The first thing to do would be to observe signal on MDIO/MCLK to find out whether the SMI interface works.

    If not, the most common problem at this stage is missing or misconfigured ETH module clock, so check if it's physically present on the required pin, that that pin is properly configured in GPIO and that any enable/steering bits are set properly. I don't use the 'H747 so don't know what the relevant details may be.

    JW

    [EDIT] ... and don't forget to check any related jumpers/solder bridges on the Disco board, too...

    YZhen.4Author
    Visitor II
    March 10, 2023

    Hello

    How to observe the signals on MDIO/MCLK to determine whether the SMI interface works.

    The official disco development board I used should be free of hardware problems, and my IO configuration is as follows, which is also consistent with the official schematic diagram.

    void HAL_ETH_MspInit(ETH_HandleTypeDef* ethHandle)

    {

     GPIO_InitTypeDef GPIO_InitStruct = {0};

     if(ethHandle->Instance==ETH)

     {

     /* USER CODE BEGIN ETH_MspInit 0 */

     /* USER CODE END ETH_MspInit 0 */

      /* Enable Peripheral clock */

      __HAL_RCC_ETH1MAC_CLK_ENABLE();

      __HAL_RCC_ETH1TX_CLK_ENABLE();

      __HAL_RCC_ETH1RX_CLK_ENABLE();

      __HAL_RCC_GPIOG_CLK_ENABLE();

      __HAL_RCC_GPIOC_CLK_ENABLE();

      __HAL_RCC_GPIOA_CLK_ENABLE();

      /**ETH GPIO Configuration

      PG11   ------> ETH_TX_EN

      PG12   ------> ETH_TXD1

      PG13   ------> ETH_TXD0

      PC1   ------> ETH_MDC

      PA2   ------> ETH_MDIO

      PA1   ------> ETH_REF_CLK

      PA7   ------> ETH_CRS_DV

      PC4   ------> ETH_RXD0

      PC5   ------> ETH_RXD1

      */

      GPIO_InitStruct.Pin = ETH_TX_EN_Pin|ETH_TXD1_Pin|ETH_TXD0_Pin;

      GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;

      GPIO_InitStruct.Pull = GPIO_NOPULL;

      GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;

      GPIO_InitStruct.Alternate = GPIO_AF11_ETH;

      HAL_GPIO_Init(GPIOG, &GPIO_InitStruct);

      GPIO_InitStruct.Pin = ETH_MDC_SAI4_D1_Pin|ETH_RXD0_Pin|ETH_RXD1_Pin;

      GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;

      GPIO_InitStruct.Pull = GPIO_NOPULL;

      GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;

      GPIO_InitStruct.Alternate = GPIO_AF11_ETH;

      HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);

      GPIO_InitStruct.Pin = ETH_MDIO_Pin|ETH_REF_CLK_Pin|ETH_CRS_DV_Pin;

      GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;

      GPIO_InitStruct.Pull = GPIO_NOPULL;

      GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;

      GPIO_InitStruct.Alternate = GPIO_AF11_ETH;

      HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

      /* Peripheral interrupt init */

      HAL_NVIC_SetPriority(ETH_IRQn, 5, 0);

      HAL_NVIC_EnableIRQ(ETH_IRQn);

     /* USER CODE BEGIN ETH_MspInit 1 */

     /* USER CODE END ETH_MspInit 1 */

     }

    }

    Super User
    March 10, 2023

    > How to observe the signals on MDIO/MCLK to determine whether the SMI interface works.

    Using oscilloscope/logic analyzer.

    Also, using oscilloscope/logic analyzer check presence of clock at the PA1=ETH_REF_CLK pin.

    Also check in RM (Reference Manual), which register bits (RCC, SYSCFG) have to be set for ETH to operate properly.

    > The official disco development board I used should be free of hardware problems,

    It probably is, but you may need to set jumpers/solder bridges properly, and you may need to switch on features in software. I don't use the 'H7 nor this Disco board, so don't know the details; have a look at the schematics and at the Disco board's User Manual.

    JW

    YZhen.4Author
    Visitor II
    March 11, 2023

    Thank you very much for your guidance. I will try