mimxrt/eth: Sleep while waiting for ETH link to come up.#19411
Conversation
Waiting for the link has a 5 second timeout, and the system should sleep efficiently and poll/process other events while waiting. Fixes issue micropython#19410. Signed-off-by: Damien George <damien@micropython.org>
|
@dpgeorge - Thanks, should be fine without a test. Also, it might be good to search the code base for tight loops like that which don't wait. |
|
Code size report: |
|
I compiled it for a Seeed Arch Mix, and ETH both times out if not connected and gets a connection if yes. Any suggestion what to test for polling being active? The wait period can be interrupted with Ctrl-C. P.S.: For Teensy 4.1 you just need the RJ45 plug: https://www.pjrc.com/store/ethernet_kit.html for ETH. |
Thanks for testing! That sound good, that both those cases work.
If the wait can be interrupted, then the polling is working. To double check that, you can try interrupting the wait with ctrl-C prior to this patch.
I have a lot of boards (as you can imagine), but I don't actually have a Teensy 4.1...! |
Check! Without this path the wait cannot be interrupted. |
Excellent! Thanks for that, now I don't need to find the right hardware :) I guess this is OK to merge now. At least it fixes this case. |
Octoprobe PR report
Failures |
Summary
Waiting for the link has a 5 second timeout, and the system should sleep efficiently and poll/process other events while waiting.
Fixes issue #19410.
Testing
Built TEENS41 to verify that it builds.
I did not test on hardware. I need to see if I can find a mimxrt board with ETH...
Trade-offs and Alternatives
The 2ms delay between subsequent polling of the PHY was copied from how the stm32 port works. That should be fast enough for minimal latency, but not too fast.
Generative AI
Not used.