Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
June 22, 2021, 11:23:36 23:23


Login with username, password and session length


Pages: [1]
Print
Author Topic: STM32F427 Ethernet issue  (Read 476 times)
0 Members and 1 Guest are viewing this topic.
burgic
Newbie
*
Offline Offline

Posts: 26

Thank You
-Given: 7
-Receive: 18


WWW
« on: May 18, 2021, 12:35:15 12:35 »

Hi,

I am experiencing an issue with ethernet initialization, to be more precise the HAL_ETH_Init() function fails at the following location, as the bit ETH_DMABMR_SR is never cleared:
Code:

  /* 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 */
  (heth->Instance)->DMABMR |= ETH_DMABMR_SR;
  
  /* Get tick */
  tickstart = HAL_GetTick();
 
  /* Wait for software reset */
  while (((heth->Instance)->DMABMR & ETH_DMABMR_SR) != (uint32_t)RESET)
  {
    /* Check for the Timeout */
    if((HAL_GetTick() - tickstart ) > ETH_TIMEOUT_SWRESET)
    {    
      heth->State= HAL_ETH_STATE_TIMEOUT;
  
      /* Process Unlocked */
      __HAL_UNLOCK(heth);
    
      /* Note: The SWR is not performed if the ETH_RX_CLK or the ETH_TX_CLK are  
         not available, please check your external PHY or the IO configuration */
      return HAL_TIMEOUT;
    }

According to the RM, the bit is automatically cleared by HW, after setting it to 1 in SW.

The things which are checked multiple times (and I really mean multiple, like more than 20 times) for proper configuration:
  • All (3) Ethernet related clocks are enabled, except for PTP clock which is anyhow optional and not required for me (checked also with Lauterbach and TRACE32)
  • The required 50 MHz clock is provided from the external ethernet switch NXP SJA1105P (a perfect sinewave is captured by oscilloscope)
  • All Ethernet related GPIOs are configured and the respective clocks enabled (checked also with Lauterbach and TRACE32)
  • ETH HAL MSP init is called as expected

Even though the initialization of the ethernet core fails, I am still able to access and read/write from/to the external PHY TJA1102. By this I also know that MDIO interface is working and those GPIOs behave and are configured properly.

The most interesting thing is that this initialization did work several times and then it just stopped working although there was not a single change in the application source code.

Unfortunately, I cannot share too much of the source code as it is the company project and protected with an NDA. Anyhow, the ETH initialization is usually pretty much straight-forward on STM32 devices and I got the same source code working on another mcu - STM32F429, but there the different GPIOs are used, different PHY addresses, etc, but in general it is the same thing and the code is just more/less ported from one MCU to this one (STM32F427). Some may argue, while porting the source code, something is forgotten and I would agree, but this is the first step in the initialization, so only GPIOs and clocks are relevant for this discussion (at least I hope), so telling me to check some other application specific details does not make sense.

The used STM32 HAL version is 1.26.1.

Any kind of feedback/comment/idea is highly appreciated as I do not have any more ideas what to try next.

Thx in advance!

P.S. I did google for solution/similar issues but did not find anything useful. It was usually the standard issue/solution - missing clocks or wrong GPIO configuration.

Cheers!




Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC