cancel
Showing results for 
Search instead for 
Did you mean: 

cubemx lan8742a auto negotiation fail

ismail fatih iltar
Associate II

Hi everyone, im using stm32f746zgt with lan8742a phy. i manage settings on cubemx. when i set speed and duplex with manually like a 100mbps full duplex my system works well. but when i change it to auto negotiation it returns with timeout. It crashes on below lines that are in stm32f7xx_hal_eth.c

/* Wait until the auto-negotiation will be completed */
    do
    {
      HAL_ETH_ReadPHYRegister(heth, PHY_BSR, &phyreg);
      
      /* Check for the Timeout */
      if((HAL_GetTick() - tickstart ) > ETH_TIMEOUT_AUTONEGO_COMPLETED)
      {
        /* In case of write timeout */
        err = ETH_ERROR;
      
        /* Config MAC and DMA */
        ETH_MACDMAConfig(heth, err);
        
        heth->State= HAL_ETH_STATE_READY;
  
        /* Process Unlocked */
        __HAL_UNLOCK(heth);
    
        return HAL_TIMEOUT;
      }
      
    } while (((phyreg & PHY_AUTONEGO_COMPLETE) != PHY_AUTONEGO_COMPLETE));

i increased ETH_TIMEOUT_AUTONEGO_COMPLETED time but nothing changed. my switch and computer eth settings are auto. What should i check ?

2 REPLIES 2

"It crashes" care to refine that a little?

If you stop the debugger where exactly is it stuck?

Is it generating an interrupt you're not catching?

Is it stuck in a loop waiting for a tick?

Checked clocks to PHY?

SysTick has sufficient priority?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
SGupt.6
Associate

HI,

HAVE YOU GOT SOLUTION FOE YOUR ISSUE..? I AM FAING SAME ISSUE .. IF YOU SUGGEST THAT WILL BE HELPFUL