-
Notifications
You must be signed in to change notification settings - Fork 267
Add support for Jetson Orin Nano Super variant #132
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
Open
Bonsaikitt3n
wants to merge
1
commit into
NVIDIA:master
Choose a base branch
from
Bonsaikitt3n:master-fix-120-gpio
base: master
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
Changes from all commits
Commits
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 hidden or 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,74 @@ | ||
| # Add support for Jetson Orin Nano Super variant | ||
|
|
||
| ## Problem | ||
|
|
||
| The Jetson.GPIO library currently fails to recognize Jetson Orin Nano "Super" developer kit variants, causing GPIO operations to fail with the error: | ||
|
|
||
| ``` | ||
| Exception: Could not determine Jetson model | ||
| ``` | ||
|
|
||
| This affects users of the newer Jetson Orin Nano Engineering Reference Developer Kit Super hardware. | ||
|
|
||
| ## Root Cause | ||
|
|
||
| The Super variants report device tree compatible strings with a `-super` suffix: | ||
| - `nvidia,p3509-0000+p3767-0005-super` | ||
| - `nvidia,p3768-0000+p3767-0005-super` | ||
|
|
||
| However, the GPIO library's device recognition only includes the non-suffixed versions: | ||
| - `nvidia,p3509-0000+p3767-0005` | ||
| - `nvidia,p3768-0000+p3767-0005` | ||
|
|
||
| ## Solution | ||
|
|
||
| This PR adds the Super variant compatible strings to the `compats_jetson_orins_nano` tuple in `gpio_pin_data.py`, enabling GPIO library functionality for these hardware variants. | ||
|
|
||
| ## Hardware Details | ||
|
|
||
| - **Model**: NVIDIA Jetson Orin Nano Engineering Reference Developer Kit Super | ||
| - **Device Tree Model**: `NVIDIA Jetson Orin Nano Engineering Reference Developer Kit Super` | ||
| - **Compatible String**: `nvidia,p3768-0000+p3767-0005-super nvidia,p3767-0005 nvidia,tegra234` | ||
|
|
||
| ## Testing | ||
|
|
||
| Tested on actual Super variant hardware: | ||
|
|
||
| **Before the fix:** | ||
| ```python | ||
| import Jetson.GPIO as GPIO | ||
| # Exception: Could not determine Jetson model | ||
| ``` | ||
|
|
||
| **After the fix:** | ||
| ```python | ||
| import Jetson.GPIO as GPIO | ||
| print(f'GPIO modes available: BOARD={GPIO.BOARD}, BCM={GPIO.BCM}') | ||
| print(f'Tegra modes available: TEGRA_SOC={GPIO.TEGRA_SOC}, CVM={GPIO.CVM}') | ||
| # ✅ All GPIO functionality working | ||
| ``` | ||
|
|
||
| ## Impact | ||
|
|
||
| - **Backward Compatible**: No changes to existing hardware support | ||
| - **Minimal**: Only adds two lines of compatible strings | ||
| - **Safe**: Uses the same pin configuration as standard Orin Nano variants | ||
| - **Community Benefit**: Enables GPIO functionality for all Super variant owners | ||
|
|
||
| ## Related Issues | ||
|
|
||
| Fixes #120 | ||
|
|
||
| ## Files Changed | ||
|
|
||
| - `lib/python/Jetson/GPIO/gpio_pin_data.py`: Added Super variant compatible strings | ||
|
|
||
| ## Verification | ||
|
|
||
| The fix has been tested with: | ||
| - All GPIO pin modes (BOARD, BCM, TEGRA_SOC, CVM) | ||
| - GPIO input/output operations | ||
| - Pin numbering verification | ||
| - Hardware abstraction layer functionality | ||
|
|
||
| This change enables the growing Super variant user community to fully utilize the Jetson.GPIO library without modification. |
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you put this in samples folder |
This file contains hidden or 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,134 @@ | ||
| #!/usr/bin/env python3 | ||
| """ | ||
| Jetson GPIO Super Variant Test Script | ||
| Tests GPIO library functionality on Jetson Orin Nano Super variants | ||
| """ | ||
|
|
||
| import os | ||
| import sys | ||
|
|
||
| def test_device_detection(): | ||
| """Test device detection and hardware info""" | ||
| print("🔍 JETSON GPIO SUPER VARIANT TEST") | ||
| print("=" * 50) | ||
|
|
||
| # Check device tree information | ||
| try: | ||
| with open('/proc/device-tree/model', 'r') as f: | ||
| model = f.read().strip() | ||
| print(f"📋 Device Model: {model}") | ||
|
|
||
| with open('/proc/device-tree/compatible', 'r') as f: | ||
| compatible = f.read().replace('\x00', ' ').strip() | ||
| print(f"🔧 Compatible: {compatible}") | ||
|
|
||
| # Check if this is a Super variant | ||
| is_super = '-super' in compatible | ||
| print(f"🎯 Super Variant: {'✅ YES' if is_super else '❌ NO'}") | ||
|
|
||
| return is_super | ||
|
|
||
| except Exception as e: | ||
| print(f"❌ Device detection failed: {e}") | ||
| return False | ||
|
|
||
| def test_gpio_import(): | ||
| """Test GPIO library import""" | ||
| print(f"\n🧪 Testing GPIO Library Import...") | ||
|
|
||
| try: | ||
| import Jetson.GPIO as GPIO | ||
| print("✅ Jetson.GPIO imported successfully!") | ||
|
|
||
| # Test basic constants | ||
| print(f"📌 GPIO Mode Constants:") | ||
| print(f" BOARD: {GPIO.BOARD}") | ||
| print(f" BCM: {GPIO.BCM}") | ||
|
|
||
| # Test Tegra-specific constants if available | ||
| try: | ||
| print(f" TEGRA_SOC: {GPIO.TEGRA_SOC}") | ||
| print(f" CVM: {GPIO.CVM}") | ||
| print("✅ Tegra modes available") | ||
| except AttributeError: | ||
| print("⚠️ Tegra modes not available (older GPIO library)") | ||
|
|
||
| return True | ||
|
|
||
| except Exception as e: | ||
| print(f"❌ GPIO import failed: {e}") | ||
| return False | ||
|
|
||
| def test_gpio_functionality(): | ||
| """Test basic GPIO functionality""" | ||
| print(f"\n⚡ Testing GPIO Functionality...") | ||
|
|
||
| try: | ||
| import Jetson.GPIO as GPIO | ||
|
|
||
| # Test mode setting | ||
| GPIO.setmode(GPIO.BOARD) | ||
| print("✅ GPIO mode set to BOARD") | ||
|
|
||
| # Test pin setup (pin 7 as output - safe test pin) | ||
| test_pin = 7 | ||
| GPIO.setup(test_pin, GPIO.OUT) | ||
| print(f"✅ Pin {test_pin} configured as output") | ||
|
|
||
| # Test pin output | ||
| GPIO.output(test_pin, GPIO.HIGH) | ||
| state = GPIO.input(test_pin) | ||
| print(f"✅ Pin {test_pin} output test: {state}") | ||
|
|
||
| # Clean up | ||
| GPIO.cleanup() | ||
| print("✅ GPIO cleanup successful") | ||
|
|
||
| return True | ||
|
|
||
| except Exception as e: | ||
| print(f"❌ GPIO functionality test failed: {e}") | ||
| return False | ||
|
|
||
| def main(): | ||
| """Run complete GPIO Super variant test""" | ||
|
|
||
| print("🏗️ JETSON ORIN NANO SUPER GPIO COMPATIBILITY TEST") | ||
| print("=" * 60) | ||
| print("This script verifies GPIO library compatibility with Super variants") | ||
| print() | ||
|
|
||
| # Step 1: Device Detection | ||
| is_super = test_device_detection() | ||
|
|
||
| # Step 2: GPIO Import | ||
| import_success = test_gpio_import() | ||
|
|
||
| # Step 3: GPIO Functionality | ||
| functionality_success = False | ||
| if import_success: | ||
| functionality_success = test_gpio_functionality() | ||
|
|
||
| # Results Summary | ||
| print(f"\n🏆 TEST RESULTS SUMMARY") | ||
| print("=" * 30) | ||
| print(f"Device Detection: {'✅ PASS' if is_super else '⚠️ Not Super variant'}") | ||
| print(f"GPIO Import: {'✅ PASS' if import_success else '❌ FAIL'}") | ||
| print(f"GPIO Functionality: {'✅ PASS' if functionality_success else '❌ FAIL'}") | ||
|
|
||
| if is_super and import_success and functionality_success: | ||
| print(f"\n🎉 SUCCESS: GPIO library fully functional on Super variant!") | ||
| print(f"💡 This confirms the Super variant patch is working correctly.") | ||
| return True | ||
| elif not is_super: | ||
| print(f"\n⚠️ NOTE: This is not a Super variant device") | ||
| print(f"💡 This test is designed for Super variant hardware") | ||
| return import_success and functionality_success | ||
| else: | ||
| print(f"\n❌ FAILED: GPIO library issues detected") | ||
| print(f"💡 Check that the Super variant patch has been applied") | ||
| return False | ||
|
|
||
| if __name__ == "__main__": | ||
| success = main() | ||
| sys.exit(0 if success else 1) |
This file contains hidden or 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.
Can you remove this file and put the content for the testing to the test python file