devices icon indicating copy to clipboard operation
devices copied to clipboard

Jetson Orin AGX

Open notnil opened this issue 2 years ago • 5 comments

What kind of new feature are you looking for? (Keep the one that applies, please describe)

  • Hardware: Jetson Orin AGX

Do you plan to:

  • Contribute an initial driver: No
  • Write unit tests: No
  • Update https://github.com/periph/cmd to use the new functionality: No

The Jetson Orin AGX has the RPi GPIO layout. Does this mean it will just work?

_, err := host.Init()
if err != nil {
    panic(err)
}

outputPin := rpi.P1_13
outputPin.Out(gpio.High)

doesn't work while the equivalent on https://github.com/NVIDIA/jetson-gpio does:

import RPi.GPIO as GPIO
import time

# Pin Definitons:
led_pin = 13  # BOARD pin 13

def main():
    # Pin Setup:
    GPIO.setmode(GPIO.BOARD)  # BOARD pin-numbering scheme
    GPIO.setup(led_pin, GPIO.OUT)  # LED pin set as output

    GPIO.output(led_pin, GPIO.HIGH)

if __name__ == '__main__':
    main()

notnil avatar Jan 15 '24 16:01 notnil

I get when logging the outputPin.Out error:

panic: bcm283x-gpio (GPIO27): subsystem gpiomem not initialized and sysfs not accessible

notnil avatar Jan 15 '24 16:01 notnil

What is needed is a detection system, see https://github.com/periph/host/blob/main/rpi/rpi.go#L28 or https://github.com/periph/host/blob/main/beagle/black/black.go#L31 or https://github.com/periph/host/blob/main/orangepi/orangepi.go#L27 for example.

maruel avatar Jan 15 '24 16:01 maruel

Ok just to confirm it won't work and I'll have to figure out another way to run?

notnil avatar Jan 15 '24 16:01 notnil

Do not use the rpi package if you are not on a raspberry pi. Instead, use GPIOs as they are named, using the gpioreg package; https://pkg.go.dev/periph.io/x/conn/v3/gpio/gpioreg#ByName

maruel avatar Jan 15 '24 16:01 maruel

package main

import (
	"os"

	"github.com/rs/zerolog"
	"periph.io/x/conn/v3/driver/driverreg"
	"periph.io/x/conn/v3/gpio/gpioreg"
)

func main() {
	logger := zerolog.New(os.Stdout)
	if _, err := driverreg.Init(); err != nil {
		logger.Fatal().Err(err).Msg("failed to initialize periph.io")
	}
	for _, pin := range gpioreg.All() {
		logger.Info().Interface("pin", pin).Msg("found pin")
	}
        if gpioreg.ByName("16") == nil {
            logger.Fatal().Msg("Failed to find GPI16")
        }
}

Doesn't find anything running on the Jetson AGX Orin. Command is run with sudo.

{"level":"fatal","message":"Failed to find GPI16"}

notnil avatar Jan 15 '24 16:01 notnil