Skip to content

Jetson Orin Nano PWM only works on Pin 33 #105

@mattwilliamson

Description

@mattwilliamson

Hello,

Pin 33 works with PWM. Pin 32 and pin 15 do not. It's just either on or off. I'm using a L293 motor controller and if I switch the pins for left and right motors, the other motor exhibits the same behavior.

Jetson Orin Nano
Jetpack 5.1.2 L4T 35.4.1
Jetson.GPIO.VERSION '2.1.6'

>>> GPIO.JETSON_INFO
{'P1_REVISION': 1, 'RAM': '32768M, 65536M', 'REVISION': 'Unknown', 'TYPE': 'JETSON_ORIN_NANO', 'MANUFACTURER': 'NVIDIA', 'PROCESSOR': 'A78AE'}

Here's my sample code:

import Jetson.GPIO as GPIO
import time

GPIO.setwarnings(False)
GPIO.setmode(GPIO.BOARD)

# Enable, forward, backward
lpin = [32, 38, 37]
rpin = [33, 35, 36]
hz = 50

GPIO.setup(lpin[0], GPIO.OUT)
GPIO.setup(rpin[0], GPIO.OUT)
GPIO.setup(lpin[1],GPIO.OUT, initial=GPIO.LOW)
GPIO.setup(rpin[1],GPIO.OUT, initial=GPIO.LOW)
GPIO.setup(lpin[2], GPIO.OUT, initial=GPIO.LOW)
GPIO.setup(rpin[2], GPIO.OUT, initial=GPIO.LOW)

lpwm = GPIO.PWM(lpin[0], hz)
rpwm = GPIO.PWM(rpin[0], hz)

lpwm.start(0)
rpwm.start(0)

#

def forward(left_speed=100, right_speed=100):
    lpwm.ChangeDutyCycle(left_speed)
    rpwm.ChangeDutyCycle(right_speed)
    GPIO.output(lpin[1],GPIO.HIGH)
    GPIO.output(rpin[1],GPIO.HIGH)
    GPIO.output(lpin[2],GPIO.LOW)
    GPIO.output(rpin[2],GPIO.LOW)


for i in range(0, 100, 1):
    print(i)
    forward(i, 0)
    time.sleep(.1)

Some more info for you:

At 50% duty cycle on pin 32 and 33:

matt@deepdrive:~$ sudo cat /sys/kernel/debug/pwm
platform/39c0000.tachometer, 1 PWM device
 pwm-0   ((null)              ): period: 0 ns duty: 0 ns polarity: normal

platform/32e0000.pwm, 1 PWM device
 pwm-0   (sysfs               ): requested enabled period: 20000000 ns duty: 0 ns polarity: normal

platform/32c0000.pwm, 1 PWM device
 pwm-0   (sysfs               ): requested enabled period: 20000000 ns duty: 10000000 ns polarity: normal

platform/32a0000.pwm, 1 PWM device
 pwm-0   (pwm-fan             ): requested enabled period: 45334 ns duty: 14045 ns polarity: normal

platform/3280000.pwm, 1 PWM device
 pwm-0   (sysfs               ): requested enabled period: 20000000 ns duty: 0 ns polarity: normal

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions