cancel
Showing results for 
Search instead for 
Did you mean: 

STMH7 ETH_DMAMR_SWR fails

BengofEtech
Associate III

Hey,

i got a specific Problem with the STM32H7 Ethernet, sometimes when performing

  SET_BIT(heth->Instance->DMAMR, ETH_DMAMR_SWR);
 
  /* Get tick */
  tickstart = HAL_GetTick();
 
  /* Wait for software reset */
  uint8_t force_reset = 0;
  while (READ_BIT(heth->Instance->DMAMR, ETH_DMAMR_SWR) > 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;
      break;
    }
  }

The error gets detectet, so ETH_DMAMR_SWR doesnt get activated within this timeout period. Is there aother way to reset the ETH Controller except from restarting the whole mcu?

I tried __HAL_RCC_ETH1MAC_FORCE_RESET but it didnt work out.

3 REPLIES 3
BengofEtech
Associate III

okay much more interesting:

  /* Get tick */
  tickstart = HAL_GetTick();
 
  /* Wait for software reset */
  uint8_t force_reset = 0;
  while (READ_BIT(heth->Instance->DMAMR, ETH_DMAMR_SWR) > 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 */
      force_reset = 1;
      break;
    }
  }
 
 
  tickstart = HAL_GetTick();
  if(force_reset)
  {
//	  tickstart = HAL_GetTick();
	  __HAL_RCC_ETH1MAC_FORCE_RESET();
	  HAL_Delay(100);
	  __HAL_RCC_ETH1MAC_RELEASE_RESET();
	  HAL_Delay(100);
	 SET_BIT(heth->Instance->DMAMR, ETH_DMAMR_SWR);
	  while (READ_BIT(heth->Instance->DMAMR, ETH_DMAMR_SWR) > 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;
	    }
	  }
  }

when optimising AND uncomment the tickstart, the whole programm wont run correctly. Anyone expirienced things like that?

BengofEtech
Associate III

there seems something wrong with data alligmnent. cant imagine, it could be something written on the flash. any experiences?

as far as i can tell, usually adding non related code in flash should not interfere with the programs ability to function, which is clearly the case here.

JackSparrow
Associate II

I have run into the same issue with my STM32H753 MCU(https://community.st.com/t5/stm32-mcus-products/stm32h753-ethernet-initialization-failure/td-p/602033)

Were you able to fix this issue?