2025-07-01 12:30 PM - last edited on 2025-07-01 11:50 PM by Imen.D
Greetings,
I am using STM32CubeIDE version 1.18, Running FreeRTOS, and using the HAL
library to configure the ETH device.
I have the STM32H573 ETH port configured as MII, and communicating with an external
ethernet switch device (also in MII mode). We want the link to be Full Duplex 10 Mbps.
We can see that the MAC CR register has bit 14 as a zero, which is 10 Mbps mode.
GRISHKA $ peek 0x40028000
[40028000] 0x3830A003
Yet, we I probe the RX and TX clocks with my scope, I see both clocks at 25 Mhz (40 nsec period).
I believe at 10 Mbps, the clock frequency should be 2.5 Mhz (400 nsec period) ?
Thanks
Ken Carlson
Edit by ST Moderator: Add the right labels
2025-07-03 2:07 AM - edited 2025-07-03 8:55 AM
Hello,
Although you are using MII mode in your configuration, the PHY integrated with the STM32H573, specifically the LAN8742A/LAN8742Ai, communicates with the MCU via a standard RMII interface and is clocked using a 25 MHz crystal oscillator according to the datasheet. In your case, the 100 Mb/s-MII mode was selected by the auto-negotiation process between the two boards, which explains the 25 MHz clock signal you observe on your scope.
As shown in the PHY block diagram, the LAN8742A/LAN8742Ai supports communication with the Ethernet MAC through RMII, providing full-duplex 10BASE-T/100BASE-TX operation at 10 Mbps and 100 Mbps speeds.
EDIT: Added more details for further clarity
Best regards,
2025-07-03 6:10 AM
Thank you for the quick and informational response!
I tried putting our external device in 100 Mbps MII, but it still drops
transmit packets, must be something else, maybe flow control?
Anyways, thanks for the assistance!
Ken
2025-07-03 6:47 AM
What I suggest you do is try the following steps:
Run your application in debug mode and set a breakpoint inside the LAN8742_GetLinkState
function. Check the value returned by the function, whether auto-negotiation is enabled, and the selected speed and duplex mode. During debugging, try forcing the external device to a specific speed and verify if the STM32 side matches that speed.
Regarding the dropped transmit packets, this could be related to flow control. To investigate, please refer to this article, which explains how to monitor the number of frames detected and received, as well as the flags triggered in case of errors.
Debugging tips when working with an Ethernet peripheral
2025-07-03 7:12 AM
Thanks!
I am running FreeRTOS, I only see the LAN8742_GetLinkState source code in the AzureRTOS (ThreadX) software.
Ken
2025-07-03 7:36 AM
You’re most welcome!
The function is located in lan8742.c under Drivers\Components\lan8742\. Please navigate there and set a breakpoint at line 264. Then, debug your code and step through it slowly until you observe which speed and duplex mode are chosen. Make sure to perform this while your board is connected to the external device and conduct the tests I suggested earlier.
2025-07-07 2:54 AM
Hello @microcoder,
Do you have any updates regarding your problem? Were you able to resolve it?
Best regards,
2025-07-07 7:02 AM
2025-07-08 3:35 AM
Hello,
Could you please provide me with the current status of the issue? This will help me guide you more effectively.
Best regards,
2025-07-08 4:47 PM