stm32ethernetstm32f4cubemx

There is a fault when trying to connect to LAN8742A with STM32F407VG through RMII protocol


Recently, I worked on custom hardware which contains an Ethernet connection. RMII is used to communicate with the device. I use FreeRTOS and LWIP. When I run the program, there is a problem, which it calls the Error Handler. This is the code that has the problem.

while (READ_BIT(heth->Instance->DMABMR, ETH_DMABMR_SR) > 0U)
{
  if (((HAL_GetTick() - tickstart) > ETH_SWRESET_TIMEOUT))
  {
    /* Set Error Code */
    heth->ErrorCode = HAL_ETH_ERROR_TIMEOUT;
    /* Set State as Error */
    heth->gState = HAL_ETH_STATE_ERROR;
    /* Return Error */
    return HAL_ERROR;
  }
}

The timer times out and gives an error. On my hardware, the Yellow (Orange) LED on the LAN connector is on (no blinking) and the green one is off. For the schematic, I used STM32H753's EVAL board schematic and I'm pretty sure the schematic is not the case.

When I was checking tutorials on the internet, in almost all of them, there was a field on the CubeMX called "PHY ADDRESS" which they changed to 0 (as on the hardware, the PHY ADD pin is connected to 0 too). But on the newer versions, the field is not there to modify it. To mention one more, when I pull the reset pin of the LAN8742 to low, the Yellow LED on the connector turns off and when I release it (pull it up), it turns on again. Any help would be appreciated.


Solution

  • On the user manual of the ST's board, there is a pull-up resistor on the nINT pin of the LAN8742 IC. This component was supposed not to be added, but I had added it on my PCB. That was why the LED was always on, and there was a fault with my device. I picked that resistor, and the problem was solved. Schematic of the LAN8742 IC