Skip to main content
Visitor II
September 29, 2022
Question

READ_BIT(heth->Instance->DMABMR, ETH_DMABMR_SR) is not change

  • September 29, 2022
  • 1 reply
  • 2976 views

Hi i'm trying tcp server with stm32f427 which combined LAN8720A phy chip

I got a problem with this code

HAL_StatusTypeDef HAL_ETH_Init(ETH_HandleTypeDef *heth)
{
 uint32_t tickstart;
 
 if (heth == NULL)
 {
 return HAL_ERROR;
 }
 if (heth->gState == HAL_ETH_STATE_RESET)
 {
 heth->gState = HAL_ETH_STATE_BUSY;
 
#if (USE_HAL_ETH_REGISTER_CALLBACKS == 1)
 
 ETH_InitCallbacksToDefault(heth);
 
 if (heth->MspInitCallback == NULL)
 {
 heth->MspInitCallback = HAL_ETH_MspInit;
 }
 
 /* Init the low level hardware */
 heth->MspInitCallback(heth);
#else
 /* Init the low level hardware : GPIO, CLOCK, NVIC. */
 HAL_ETH_MspInit(heth);
 
#endif /* (USE_HAL_ETH_REGISTER_CALLBACKS) */
 }
 
 __HAL_RCC_SYSCFG_CLK_ENABLE();
 
 /* Select MII or RMII Mode*/
 SYSCFG->PMC &= ~(SYSCFG_PMC_MII_RMII_SEL);
 SYSCFG->PMC |= (uint32_t)heth->Init.MediaInterface;
 /* Dummy read to sync SYSCFG with ETH */
 (void)SYSCFG->PMC;
 
 /* Ethernet Software reset */
 /* Set the SWR bit: resets all MAC subsystem internal registers and logic */
 /* After reset all the registers holds their respective reset values */
 SET_BIT(heth->Instance->DMABMR, ETH_DMABMR_SR);
 
 /* Get tick */
 tickstart = HAL_GetTick();
 
 /* Wait for software reset */
 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;
 }
 }
...

In this code read bit is just be 1 and never changed

I got tried another LAN8720A which package is diff one but it works..!?

I dont understand what happen..but I just wanna know which should i check for this situation..

thanks

    This topic has been closed for replies.

    1 reply

    Graduate II
    October 5, 2022