-
Notifications
You must be signed in to change notification settings - Fork 107
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
Eye scan support #518
Open
tfcollins
wants to merge
6
commits into
main
Choose a base branch
from
tfcollins/eye-diagram
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Eye scan support #518
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
0f5985c
Add JESD eye scan helper and example
tfcollins 3b96e82
Add JESD debug support to AD9081
tfcollins b44ead5
Add JESD test fixture and add AD9081 test for JESD
tfcollins d268e40
Fix JESD204 eyescan to handle lanes better
tfcollins 8e7a6f6
Fix scaling
tfcollins 54c2a10
Add Time UI secondary axis
tfcollins File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import time | ||
|
||
import adi | ||
import matplotlib.pyplot as plt | ||
from scipy import signal | ||
|
||
dev = adi.ad9081("ip:10.44.3.92", disable_jesd_control=False) | ||
|
||
# Configure properties | ||
print("--Setting up chip") | ||
|
||
dev._ctx.set_timeout(90000) | ||
|
||
fig = plt.figure() | ||
|
||
eye_data_per_lane = dev._jesd.get_eye_data() | ||
|
||
num_lanes = len(eye_data_per_lane.keys()) | ||
|
||
for i, lane in enumerate(eye_data_per_lane): | ||
|
||
x = eye_data_per_lane[lane]["x"] | ||
y1 = eye_data_per_lane[lane]["y1"] | ||
y2 = eye_data_per_lane[lane]["y2"] | ||
|
||
ax1 = plt.subplot(int(num_lanes / 2), 2, int(i) + 1) | ||
plt.scatter(x, y1, marker="+", color="blue") | ||
plt.scatter(x, y2, marker="+", color="red") | ||
plt.xlim(eye_data_per_lane[lane]["graph_helpers"]["xlim"]) | ||
plt.xlabel(eye_data_per_lane[lane]["graph_helpers"]["xlabel"]) | ||
plt.ylabel(eye_data_per_lane[lane]["graph_helpers"]["ylabel"]) | ||
plt.rcParams["axes.titley"] = 1.0 # y is in axes-relative coordinates. | ||
plt.rcParams["axes.titlepad"] = -14 # pad is in points... | ||
plt.title(f" Lane {lane}", loc="left", fontweight="bold") | ||
fig.suptitle( | ||
f"JESD204 MxFE 2D Eye Scan ({eye_data_per_lane[lane]['mode']}) Rate {eye_data_per_lane[lane]['graph_helpers']['rate_gbps']} Gbps" | ||
) | ||
plt.axvline(0, color="black") # vertical | ||
plt.axhline(0, color="black") # horizontal | ||
plt.grid(True) | ||
# Add secondary x-axis | ||
x_norm = [round(n * 0.1, 2) for n in range(11)] | ||
x.sort() | ||
x = np.linspace(min(x), max(x), 11) | ||
|
||
ax2 = ax1.twiny() | ||
ax2.set_xlim(ax1.get_xlim()) | ||
ax2.set_xticks(x) | ||
ax2.set_xticklabels(x_norm) | ||
ax2.set_xlabel("Unit Interval (UI)") | ||
|
||
plt.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import time | ||
|
||
import adi | ||
import pytest | ||
|
||
|
||
def check_jesd_links(classname, uri, iterations=4): | ||
"""Check that the JESD links are up and in DATA mode | ||
|
||
Args: | ||
classname (str): The name of the class to instantiate | ||
uri (str): The URI of the device to connect to | ||
iterations (int): The number of times to check the JESD links | ||
""" | ||
|
||
sdr = eval(f"{classname}(uri='{uri}', disable_jesd_control=False)") | ||
|
||
for _ in range(iterations): | ||
# Check that the JESD links are up | ||
links = sdr._jesd.get_all_statuses() | ||
for link in links: | ||
print(f"Link {link} status: \n{links[link]}") | ||
assert links[link]["enabled"] == "enabled", f"Link {link} is down" | ||
assert links[link]["Link status"] == "DATA", f"Link {link} not in DATA mode" | ||
|
||
time.sleep(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
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.
I updated the driver to return -EINVAL if a physical lane is not used (virtually mapped)
So we could do:
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.
I added some pieces around this. There was some confusion around the link naming in sysfs which always goes 0,1,2,... N which is not the actual lanes mapped index. This is handled now