diff --git a/lib/python/Jetson/GPIO/gpio_pin_data.py b/lib/python/Jetson/GPIO/gpio_pin_data.py index 58a5ba8..cd96576 100755 --- a/lib/python/Jetson/GPIO/gpio_pin_data.py +++ b/lib/python/Jetson/GPIO/gpio_pin_data.py @@ -94,8 +94,11 @@ "nvidia,p3509-0000+p3767-0005", "nvidia,p3768-0000+p3767-0005", "nvidia,p3768-0000+p3767-0005-super", + "nvidia,p3509-0000+p3767-0005-super", "nvidia,p3768-0000+p3767-0003-super", + "nvidia,p3509-0000+p3767-0003-super", "nvidia,p3768-0000+p3767-0004-super", + "nvidia,p3509-0000+p3767-0004-super", ) JETSON_ORIN_PIN_DEFS = [ diff --git a/samples/jetson_gpio_super_test_script.py b/samples/jetson_gpio_super_test_script.py new file mode 100644 index 0000000..1f045b8 --- /dev/null +++ b/samples/jetson_gpio_super_test_script.py @@ -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) \ No newline at end of file