cancel
Showing results for 
Search instead for 
Did you mean: 

HAL MDIO on Nucleo-H7A3ZI-Q

Promise_Conti
Associate II

Hello everyone,

 

I would like to know if the Nucleo-H7A3ZI-Q supports the MDIO to external Ethernet PHY control via SMI (MDC and MDIO). I have the setup connected, and I have programmed it accordingly but the MDC and MDIO Lines are always LOW, not even a hint of toggling or any thing on the PINS when viewed on a logic analyser.

This brings me to my question. Does the Nucleo-H7A3ZI-Q support control on an external PHY.

 

Best regards

18 REPLIES 18

Hi LCE,

 

for my use case, I do not care about the actual Ethernet Traffic, therefore I pay not attention to the RMII interfaces. I only to have access to the external PHY registers via SMI. 

Can you expand more on the init the MDIO peripheral, I think I am definitely missing a step that's why the SMI lines are LOW, Where can I find the clock.cpp?

LCE
Principal

clock.cpp?

I don't know the H7A, but from the screenshot it looks like the H7A has an MDIO peripheral, very similar to other peripherals, like SPI, I2C, ADC...

So only guessing from here (no time to download and check datasheet / ref manual -> your job), if MDIO is a peripheral, it is usually set up / initialized by:

- starting the peripheral clock (some HAL function like HAL_CLK_ENABLE_MDIO() or so)
- configuring the GPIO pins
- setting some MDIO registers

Is there a function like "MX_MDIO_init()" or so?

Hi LCE, 

 

These are the functions I have on the Initilization:

 HAL_MDIOS_Init(&hmdios);

MDIOS_HandleTypeDef hmdios;

static void MX_MDIOS_Init(void)
{

  /* USER CODE BEGIN MDIOS_Init 0 */

  /* USER CODE END MDIOS_Init 0 */

  /* USER CODE BEGIN MDIOS_Init 1 */

  /* USER CODE END MDIOS_Init 1 */
  hmdios.Instance = MDIOS;
  hmdios.Init.PortAddress = 0x09;  // User defined address
  hmdios.Init.PreambleCheck = MDIOS_PREAMBLE_CHECK_ENABLE;
  if (HAL_MDIOS_Init(&hmdios) != HAL_OK)
  {
    Error_Handler();
  }
  /* USER CODE BEGIN MDIOS_Init 2 */

  /* USER CODE END MDIOS_Init 2 */

}

But the issue still persists.

LCE
Principal

HAL_xyz_Init() usually calls a function named like HAL_xyz_MspInit(), which should be in the same xyz.c file.

That one usually enables the peripheral clock and sets up the GPIOs.

STea
ST Employee

Hello @Promise_Conti ,

MDIOS can't communicate with an external PHY because the PHY will behave as a slave also so no one will initiate the communication.
you need to have a master communicating with MDIOS providing its clock so normally you will not see any traffic on the MDIO /MDC lines as a clock and a command to the address programmed in the slave should be provided.

otherwise MDIO/MDC are quite simple to emulate using normal GPIO if you are constrained to use this product series, or you can switch to a product supporting master MDIO/MDC communication.
please refer to sections 59.3.3 and 59.3.5 of RM.
Regards

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Hello @STea ,

 

You are right, the Nucleo-H7A3ZI-Q cannot initiate the SMI communication because it is also a SLAVE ( I found this choice of architecture really fascinating as I would have expected MCUs to serve as ETH MAC Master and definately not as SLAVE to another MCU).

This issue seems to also have been treated here How to generate MDC 

 

Thanks for your support, I will switch to another Product

LCE
Principal

@STea just curious, what's that MDIO slave-only interface for?

STea
ST Employee

Hello @LCE ,

a usecase that I imagine is possible for this Periph is to control switch ports VIA gpios by receiving commands form to manage network stations for example. it can be set to communicate networking configuration Data as well.
Regards

 

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.