-
Notifications
You must be signed in to change notification settings - Fork 2.1k
cpu/stm32: periph_eth: Use auto-negotiation #15203
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
Conversation
I think it makes sense to keep manual PHY configuration and implement this as optional (pseudo) module. That way users with low ROM could opt out (by not explicitly opting in). I would like to have the optional auto-negotiation depend on the
|
2dfacf4
to
98ba1bf
Compare
Ups, I somehow squashed two commits accidentally |
f1fac00
to
5a94012
Compare
Split back up. |
@kfessel: Since you reported the bug this PR fixes, do you care to test? |
@maribu: There seems some debugging enabled in your pr – disabled it: /RIOT/cpu/stm32/periph/eth.c I did test on BOARD=nucleo-f767zi Test: Before I started to count to 50 I had one time where it seemed to not have initialized but this could also be that i got caught by a very long taking initialization (> a couple of seconds) Before this patch i had at least one failed Initialization in 10 tries (i checked just before and kept everything but the Riot branch (master vs this pr) the same) my test verdict: |
Previously, only an link-up event was triggered, not an link down event. And additionally, once the link-up event was sent, the link status was no longer monitored. As a result, once a link-up was sent, no further link event were triggered.
5a94012
to
fc19219
Compare
Rebased and fixed the accidental change of @kfessel: I have no idea why the boot is delayed by that amount of time. The driver now just waits for the PHY to reset, which shouldn't be a matter of seconds. But maybe it is :-/ |
I would also think the PHY reset takes different times i added:
to 2020-10-12 15:52:29,532 # main(): This is RIOT! (Version: 2021.01-devel-118-g5a940-pr-mar-15203) then is start t pings every 200ms similar behavior (does not depend on whether there is data or not) 2020-10-12 15:53:21,639 # main(): This is RIOT! (Version: 2021.01-devel-118-g5a940-pr-mar-15203) P.S.: while doing this i got one no initialization and saw that the reset was to short to reset the STM32 completely (random manual very (to) short) |
@maribu since this xtime is very random it may be a good entropy for pseudo random initialisation |
@marian you should check default configuration since unused static function is consider an error:
rebased and testing for the error I disussed with you |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good and @kfessel confirmed it working - please squash.
9366448
to
b602dca
Compare
Expose the auto-negotiation feature of the Ethernet device via the pseudo-module stm32_eth_auto. With this enabled, the static speed configuration set in the boards periph_conf.h will only be used if the PHY lacks auto-negotiation capabilities - which is unlikely to ever happen.
b602dca
to
5f9b55a
Compare
Thanks :-) |
Contribution description
Most Ethernet PHYs support auto-negotiation of signaling specification. This is more reliable and easier to use than manual configuration, as this will select the fastest configuration supported by both communication partners automatically.
This PR exposes the auto-negotiation capability via the (pseudo-) module
stm32_eth_auto
. Note: It requires that the Ethernet PHY is actually capable of this - but I don't think any Fast Ethernet PHYs without auto-negotiation are on the market anymore.This PR also fixes the link state notification, why previously only covered link up events and stopped worked after the first event was generated. With this fix, the link state will be continuously monitored (sadly by polling every second the state) and both link up and link down event should be generated.
Testing procedure
USEMODULE += stm32_eth_link_up
, both link up and link down event should be generated. This should now work after the first plugging in.USEMODULE += stm32_eth_auto
, the Ethernet device should use the highest speed supported by both partners, regardless of manual configurationstm32_eth_auto
being used by simply waiting for the PHY to power up before trying to configure it.Issues/PRs references
Depends on and includes:
periph_eth
#15200Fixes: #13490