PWM not functioning on pins 32 and 33

Hello everyone,
I am having issues with PWM on pins 32 and 33, which I urgently need to resolve. I enabled the PWM on pins 32 and 33 via:
sudo /opt/nvidia/jetson-io/

But when setting PWM for controlling motors via my L298N bridge from a Python script on my Jetson NANO, they go full speed, no matter the PWM I set.

This is the output of $ sudo cat /sys/kernel/debug/pwm:

platform/70110000.pwm, 1 PWM device
 pwm-0   (pwm-regulator       ): requested enabled period: 2500 ns duty: 0 ns polarity: normal

platform/7000a000.pwm, 4 PWM devices
 pwm-0   ((null)              ): period: 0 ns duty: 0 ns polarity: normal
 pwm-1   (pwm-regulator       ): requested period: 8000 ns duty: 1440 ns polarity: normal
 pwm-2   ((null)              ): period: 0 ns duty: 0 ns polarity: normal
 pwm-3   (pwm-fan             ): requested enabled period: 45334 ns duty: 0 ns polarity: normal

I’m new to embedded developing, so any help would be appreciated! The other topics on the issue couldn’t seem to resolve it tho…

This is my Python script controlling the motors:

import Jetson.GPIO as GPIO
import time

# Set the mode of numbering the pins.

# Motor A
ENA = 32  # Speed control for motor A (PWM)
IN1 = 35  # Direction
IN2 = 37  # Direction

# Motor B
ENB = 33  # Speed control for motor B (PWM)
IN3 = 38  # Direction
IN4 = 40  # Direction

# Set up the pins

# Set PWM frequency
pwm_A = GPIO.PWM(ENA, 1000)  # Frequency in Hz
pwm_B = GPIO.PWM(ENB, 1000)  # Frequency in Hz

# Start PWM

def motorControl(motor, speed, direction):
    if motor == 'A':
        pwm = pwm_A
        in1 = IN1
        in2 = IN2
        pwm = pwm_B
        in1 = IN3
        in2 = IN4


    if direction == 'r':
        GPIO.output(in1, GPIO.HIGH)
        GPIO.output(in2, GPIO.LOW)
    elif direction == 'f':
        GPIO.output(in1, GPIO.LOW)
        GPIO.output(in2, GPIO.HIGH)
        GPIO.output(in1, GPIO.LOW)
        GPIO.output(in2, GPIO.LOW)

    while True:
        pwm_1, pwm_2, dir_1, dir_2, stime = input("PWM1, PWM2, DIR1, DIR2, TIME: ").replace(" ", "").split(",")

        motorControl("A", int(pwm_1), dir_1)
        motorControl("B", int(pwm_2), dir_2)


        motorControl("A", 0, "x")
        motorControl("B", 0, "x")


Any help would be appreciated, thanks in advance!


Please first make sure you are using a DevKit.
Setting the expansion header with Jetson-IO only works with DevKits, and otherwise you have to change the pinmux spreadsheet for custom carrier boards.

Then give this sample code a try.

Hello DaveYYY,
Thank you for the quick response.
How exactly can I enable the PWM now, this is not really clear to me? Is it this?
If so, am I able to control the PWM from Python then?
Thanks in advance!

Do you understand what I said here?
I was asking whether you are using a DevKit or not.

Yes. I do believe I have a devkit. I got it from amazon and it said development kit. But for some reason PWM isn’t working when modifying the pins with Jetson-IO.

(When I set the PWM pins in Jetson-IO, they are still set in the UI after a reboot)

I don’t really know what you mean with this.
Even the sample code fails to run?

I tried it with an LED connected to the PWM pin (33) and GND and it is just on with the same brightness as the 3.3V output. This is the issue. And I’m really desperate :(

EDIT: To clarify, I meant the sample code you provided.

And what I meant with

(When I set the PWM pins in Jetson-IO, they are still set in the UI after a reboot)

Was that after setting the PWM pins using Jetson-IO, they are still set when entering Jetson-IO after a reboot.

Please follow this post to setup the PWM pins and run the code:

(It’s intended for AGX Orin, so select the right pins for Nano.)
If it still does not work, find a scope to measure the signal.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.