Hi
I’m i want to use the GPIO pins with PWM but I’m not able to see any proper documentation about it.
I tried to look for a wiring project but looks like that it’s not been updated for 10 years.
Any help?
Hi
I’m i want to use the GPIO pins with PWM but I’m not able to see any proper documentation about it.
I tried to look for a wiring project but looks like that it’s not been updated for 10 years.
Any help?
Thanks. Already took a look.
There is no indication to pwm.
You can control PWM with sysfs using the kernel documentation.
Enable the pwmX pin in dtb or using overlays (rsetup,armbianEnv.txt,etc…), after that, you can use it from userspace after exporting it and following the kernel docs.
Example on 3W:
echo 0 > /sys/class/pwm/pwmchip8/export
root@rzero-3w:/home/rock/rockchip/mpu6050# ls /sys/class/pwm/pwmchip8/pwm0/
capture duty_cycle enable output_type period polarity power uevent
root@rzero-3w:/home/rock/rockchip/mpu6050#
set period, polarity (normal), and the duty_cycle, after that, you enable it:
echo 1 > /sys/class/pwm/pwmchip8/pwm0/enable
You can control anything, from Fan, Servo, and Brushless motors.
In addition,
I’m not able to use mraa python code:
I’m following this page: https://docs.radxa.com/en/rock5/rock5b/app-development/mraa?board=ROCK+5B+&gpio=Python&pwm=Python#pwm
But not able to use the python library, getting the following error on installation:
sudo apt install python3-mraa
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
python3-mraa : Depends: libpython3.9 (>= 3.9.1) but it is not installable
E: Unable to correct problems, you have held broken packages.
Which image did you use ?
Mraa’s pwm-related operations may not be well suited to kernels 6.1 and above.
Because mraa has fatened the pwmchip, but 6.1 and above kernel pwm driver is generated from pwmchip0 by default, if you enable one pwm’s overlay, /sys/class/pwm directory will generate one pwmchip0, if you enable two pwm’s, /sys/class/pwm directory will generate one pwmchip0, /sys/class/pwm directory will generate one pwmchip0, if you enable two pwm’s If you enable overlay for one pwm, a pwmchip0 will be generated in the /sys/class/pwm directory, if you enable overlay for two pwms, a pwmchip0 and a pwmchip1 will be generated in the /sys/class/pwm directory, and so on.
thanks. this is what I did eventually.
still the order of them is not clear but I will figure it out