Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

network: Network auto-negotiation duplex fix for LAN8742 #4171

Closed
wants to merge 1 commit into from

Conversation

bkerler
Copy link
Contributor

@bkerler bkerler commented Aug 30, 2024

On auto-negotiation using the external network phy LAN8742, the reference stm32f427 source code incorrectly uses the wrong PHY_SR (status register) addr of 0x10, leading to a false detection of the duplex mode, thus using half-duplex instead of duplex mode, resulting in retransmissions and overall lower throughput of data.

According to the LAN8742a datasheet, page 89, "4.2.22 PHY Special Control/Status Register" the addr is defined as 31 (0x1E), with duplex/half-duplex speed indicator given in bit 4..2.

This patch fixes the duplex mode for the ethernetif.c ... it might be necessary to patch the legacy HAL_ETH_Init as well within the lib/Drivers/STM32F4xx_HAL_Driver/Src/Legacy/stm32f4xx_hal_eth.c.

See further details here as well for reference.

Somewhat related to issue #3049 (not for wifi, but ethernet part)

@ivous
Copy link

ivous commented Dec 11, 2024

Hello @bkerler ,
Thank you for your help to improve the Ethernet communication! I have checked proposed fix, but it is not complete unfortunately. There is missing update of other LAN8742 register flags as well. I have tried to finalize from my side and I have reached the state when PHY did connect in full-duplex mode, however the DHCP was not working properly then, which means more changes needs to be done.
The stm32f4xx_hal_eth_legacy.h file, is legacy implementation from STMicroelectronics and since then many updates were done. From my point of view it does not make sense to fix this legacy code , but we need to switch to updated HAL version from STMicroelectronics. We have a plan to do it, however this will take some time to implement.

@ivous ivous closed this Dec 11, 2024
@bkerler
Copy link
Contributor Author

bkerler commented Dec 11, 2024

@ivous Can you please elaborate which dhcp issues you mean ? I'm using the patch without any issues and can confirm the ethernet connection does work in full-duplex and dhcp works as well.

@bkerler
Copy link
Contributor Author

bkerler commented Dec 13, 2024

This PR has a followup in #4342. As @ivous stated, there were issues that needed to be addressed, thus the followup PR with the upgraded STMF4 Hal as recommended by @ivous :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants