Whats the typical / correct way to do PWM on GPIO-pins?
Now I’m doing:
- Find memory address for pin, by looking in tegra19x-mb1-pinmux-p3668-a01.cfg
- Example: PN.01 / GPIO13 / SOC_GPIO54 | 0x02440020
- Use setting that I get from using the pinmux excel-sheet, which I have to start a computer with Microsoft Office to be able to run - then mangle it trough the pinmux-dts2cfg.py python script.
- Set this value with devmem:
#pinmux.0x02440020 = 0x00000406; # soc_gpio54_pn1: gp, pull-down, tristate-disable, input-disable, lpdr-disable sudo busybox devmem 0x02440020 32 0x406
- Set the PWM values I want to use:
sudo sh -c "echo 0 > /sys/class/pwm/pwmchip0/export" sudo sh -c "echo 10000 > /sys/class/pwm/pwmchip0/pwm0/period" sudo sh -c "echo 2500 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle" sudo sh -c "echo 1 > /sys/class/pwm/pwmchip0/pwm0/enable"
I understand that I can change the .cfg and reflash the board, but that’s even more cumbersome.
Is there really no easier way to do this?
Would be great if the correct pinmux was set when using the sysfs export function, or similar.
Please enlighten me!