Now I’m trying to control a motor by using PWM.
I searched for the information, and I found that 4 pins in J15 can be used as PWM outputs.
However, I don’t know how to control these pins.
Can I control them by using Jetson.GPIO library?
Check out the article below. They uses RPi.GPIO for PWM on Raspberry Pi. The Jetson.GPIO library is supposed to be code compatible with RPi.GPIO and also Raspberry Pi pin compatible. Haven’t yet tried it, but plan to in the near furture.
Thank you for your information, but when I tried the code in the website, I got the error that module ‘Jetson.GPIO’ has no attribute ‘PWM’.
And, in /opt/nvidia/jetson-gpio/doc/README.txt,
“The Jetson GPIO library provides all public APIs provided by the RPi.GPIO library with the exception of the Software PWM APIs”.
Does this mean that it is impossible to control PWM by using Jetson.GPIO?
That is a major bummer. Thanks for trying it out. Hopefully nvidia may have some updates to include PWM in the Jetson.gpio library or they may have another way to handle it. I need PWM capability for my project too.
if Jetson Nano indeed is using the same layout, you should able to enable those as well. so, two PWM pin with two channel each.
but, I did further research by checking the actually device by ls /sys/class/pwm
I got pwmchip0 pwmchip4
if you cd to pwmchip0 and cat npwm you will get 4, which means pwmchip0 have 4 channel, and then if you do the same for pwmchip4 you will get 1, which means pwmchip4 only have 1 channel. So, that is different than Raspberry Pi layout. So, there are total 5 channels (vs. 4 channel from Pi)
Theoretically, if you know which pin is each channel is corresponding to, you can use it without problem. Hope there are some official answer here.
I am able to use the pin 33 as pwm but cant do same for pin 32,getting the following error:
Traceback (most recent call last):
File “ras.py”, line 44, in
main()
File “ras.py”, line 20, in main
p = GPIO.PWM(output_pin, 100)
File “/usr/local/lib/python3.6/dist-packages/Jetson/GPIO/gpio.py”, line 595, in init
_export_pwm(self._ch_info)
File “/usr/local/lib/python3.6/dist-packages/Jetson/GPIO/gpio.py”, line 231, in _export_pwm
f.write(str(ch_info.pwm_id))
OSError: [Errno 16] Device or resource busy
in file “/usr/lib/python3/dist-packages/Jetson/GPIO/gpio_pin_data.py”:
it says:
# Older versions of L4T have a DT bug which instantiates a bogus device
# which prevents this library from using this PWM channel.
(168, {}, "6000d000.gpio", 32, 12, 'GPIO07', 'LCD_BL_PW', '7000a000.pwm', 0),
(38, {}, "6000d000.gpio", 33, 13, 'GPIO13', 'GPIO_PE6', '7000a000.pwm', 2),