phy/rmii.py: added LiteEthPHYRMIISpeedDetect Module to automatically detects the speed (10Mbps or 100Mbps) #185
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Current
RMIIpolicy regarding speed is based onLiteEthPHYRMIICTOR parameter or aCSRStorage. 10Mbps or 100Mbps are selected at build time and may be modified manually at runtime.But Its not always easy and requires intervention.
To have an automatic approach some solutions are possibles:
rx_clk(an output PHY's pin): 2.5MHz for 10Mbps or 25MHz for 100Mbps. By counting number of ref clk between two rising edge it's possible to deduce frequency/speed. This pin is not always available.Another solution, according to
RMIIprotocol is to count the number of clock cycle during /J/ /K/ sequence (betweencrs_highrising edge and start of preamble (rx_data[0] goes high))Here to screenshot of the counter and the delay between these transitions.
10Mbps


100Mbps
Difference between counter's values is a good solution to detect speed.
Note: threshold is configurable at build time with speed_counter_threshold parameter (and fixed to 20 by default)