How to control a servo from Jetson Orin Nano?

I am trying to control a servo motor from a Jetson Orin Nano’s header pins. I realized that the signal pins on the Orin Nano only output 3.3V so I bought a TXS0108E Level shifter to increase the voltage from 3.3V to 5V. I used this script to test the servo.

import Jetson.GPIO as GPIO
import time

servo_pin = 15
GPIO.setmode(GPIO.BOARD)

GPIO.setup(servo_pin, GPIO.OUT, initial=GPIO.HIGH)

while True:
     print("LOW")
     GPIO.output(servo_pin, GPIO.LOW)
     time.sleep(2)
     print("HIGH")
     GPIO.output(servo_pin, GPIO.HIGH)
     time.sleep(2)
GPIO.cleanup()

However, nothing happened to the servo. Right now, I can only see two potential issues, either the level shifter does not work, OR the code is wrong, is there a way to control the angle of a servo rather than just set the pin to high or low?
Please help me with this.

Hi anay.gokhale123,

Are you using the devkit or custom board for Orin Nano?
What’s the Jetpack version in use?

Are you using the following on GPIO of J12?
imageg
If so, have you configured it as Output in pinmux spreadsheet?

I am using the devkit
Jetpack 5.1.3 (I cannot change this as I need to use the Intel RealSense d435i that does not work on Jetpack 6 without some driver which has a complicated installation process)
I used both pin 15 and pin 33. I followed these instructions and turned on both of these pins as well as the other pwm ones and pin 13.

Additionally I something that is probably causing this issue. When I setup a breadboard with the 3.3V power from pin 1 into VA of the TXS0108E, the 5V power from pin 2 to VB, a common ground from pin 6 to GND through the breadboard, and 3.3V power to OE through the breadboard from pin 1, all of the voltages are fine, but as soon as I connect a wire from pin 15 or pin 33 (I have not tried anything else) to A1 of the level shifter, the 5V from pin 2 drops down to 2.4V even if there is no code running to affect the GPIO pin and it is set to 0V.

What might be the issue?

Hi anay.gokhale123,

Do you want to use PIN15 as GPIO or PWM?
If you want to use it as GPIO and control it manually, you should configure it as Output in pinmux spreadsheet.
If you want to use it as PWM, then using Jetson-IO to configure its pinmux and the steps in Unable to generate PWM with Nvidia Jetson AGX Orin Development Kit - #6 by KevinFFF should work to generate the PWM output.

It sounds like another issue, please open another topic to discuss in details.