I am using some GPIO pins on the Jetson TX2 (header J21) to run three stepper motors. I am using while loops to produce signals but I am looking for some way to produce precise signals using the Jetson’s hardware (like using its internal clock e.g. PWM). Is there any way that I can do that or I have to connect another device like RPi to Jetson TX2 and run the stepper motors with that?
please check GitHub - NVIDIA/jetson-gpio: A Python library that enables the use of Jetson's GPIOs,
the library has the same API as the RPi.GPIO library for Raspberry Pi in order to provide an easy way to move applications running on the Raspberry Pi to the Jetson board.
Yes, I am using the same library. My problem is another thing. I am trying to produce a precise signal at a particular frequency to run my stepper motor. Is there such a capability in Jetson TX2’s GPIO pins to produce signals at a particular frequency? Right now I am making the signal with while loop in Python script but it is not very precise.
Jetson.GPIO library supports PWM only on pins with attached hardware PWM controllers.
you should modify the pinmux configuration, had you complete board configuration by using pinmux spreadsheets?
you may access L4T Driver Package (BSP) Sources,
please refer to kernel documentation for information related to sysfs node of PWM controllers that comes up on enabling PWM.
for example, $L4T_Sources/r32.5/Linux_for_Tegra/source/public/kernel/kernel-4.9/Documentation/pwm.txt
here’s an example to set PWM pulse of period 20us and 50% duty cycle.
$ cd /sys/class/pwm/pwmchip0 $ echo 0 > export $ cd pwm0 $ echo 20000 > period (20us is the total time period of the pulse) $ echo 10000 > duty_cycle (50% duty cycle) $ echo 1 > enable