I am trying to write a simple pwm python script, but I am getting no pwm signal for both 33 and 32 pins. My Nano is connected to a Saleae logic analyzer on Async serial. Notice that the gpio pin is initially high. I observe that the signal spikes low for a second when I run my program. If i setup the pin to be initially low, it stays low. If its initially high, it stays high. I also played with a range of frequencies if that made a different. Still nothing. I know my gpio pins work because I can set them high or low. I observe no fatal errors when running the code.
I made sure to:
- 40 pin expansion headers are configured for PWM
- Jetson.GPIO python module is installed
- User has permissions to gpio by adding user to group
- installed custom udev rules and rebooted
Here is my python script:
import RPi.GPIO as GPIO
import time
output_pin = 32
GPIO.setmode(GPIO.BOARD)
GPIO.setup(output_pin, GPIO.OUT, initial=GPIO.HIGH)
p = GPIO.PWM(output_pin, 50)
p.start(25)
print(“running pwm.py”)
while True:
time.sleep(5)
p.stop()
GPIO.cleanup()
Here is the output to 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 (sysfs ): requested period: 20000000 ns duty: 5000000 ns polarity: normal
pwm-1 (pwm-regulator ): requested enabled period: 8000 ns duty: 1440 ns polarity: normal
pwm-2 (sysfs ): requested enabled period: 20000000 ns duty: 14000000 ns polarity: normal
pwm-3 (pwm-fan ): requested enabled period: 45334 ns duty: 0 ns polarity: normal