Good morning everyone,
When trying to control a stepper motor through the GPIO header on the AGX Xavier I ran into the following issue:
When utilizing the jetson-gpio library for python compatible GPIO control I am able to run all sample scripts (including the ‘simple_pwm.py’, this is relevant later in this post).
However, when I attempt to use the JetsonGPIO librari for c++ compatible GPIO control the following error appears when using the GPIO::PWM() command:
This exact same command in Python (syntax) seems to work. I have moved the 99-gpio.rules file to /etc/udev/rules.d and created the gpio group and added my user. Nothing seems to work.
Have you tried while running your program with “
Jep. Without sudo an error regarding “/export” is thrown. This is “fixed” by using sudo but then i still get the gpio permission error.
it looks like you would like to use PWM.
please also check PWM status and share the results.
$ sudo cat /sys/kernel/debug/pwm
Hi @JerryChang, thanks for your reaction.
Indeed, I would like to use PWM. Executing your suggested command gives the following output :
Good afternoon everyone,
In the hopes that this will help someone else in the future:
In the meantime I have found another problem, and solution to this very same problem. Firstly, I need to correct myself regarding a statement I made in the original post. Even though the Python library did not throw an error when using the GPIO.PWM() function, it was in fact not operational either. This sparked my interest as the gpio could be reached but did not actually provide the pin with PWM signal.
As explained in the following link: https://docs.nvidia.com/jetson/l4t/index.html#page/Tegra%20Linux%20Driver%20Package%20Development%20Guide/hw_setup_jetson_io.html
The GPIO header of a Jetson device can be configured. The 3 PWM pins on the 40-pin expansion header are disabled by default so you will need to enable them.
By executing the following command:
$ sudo /opt/nvidia/jetson-io/jetson-io.py
You can configure the PWM pins and enable them.
Now the PWM DOES work via the python jetson-gpio library. Sadly the permission issue for the C++ library still persists.