OldMan Posted February 21, 2017 Posted February 21, 2017 With a little shell script I can switch gpio6 on/off: #!/bin/sh # PWM1 / GPIOA6 P=6 G="/sys/class/gpio/gpio${P}" if [ ! -d "${G}" ]; then echo "Exporting GPIO${P}" echo ${P} > /sys/class/gpio/export echo out > ${G}/direction fi i=100 while [ "$i" -gt 0 ]; do i=`expr $i - 1` sleep .2 echo 1 > ${G}/value sleep .1 echo 0 > ${G}/value done if [ -d "${G}" ]; then echo "Unexporting GPIO${P}" echo ${P} > /sys/class/gpio/unexport fi but I dont see anything which could enable PWM on this pin: root@nanopineo:~# ll /sys/class/gpio/gpio6/ total 0 -rw-r--r-- 1 root root 4096 Feb 21 11:38 active_low lrwxrwxrwx 1 root root 0 Feb 21 11:38 device -> ../../../sunxi-pinctrl -rw-r--r-- 1 root root 4096 Feb 21 11:37 direction -rw-r--r-- 1 root root 4096 Feb 21 11:38 edge drwxr-xr-x 2 root root 0 Feb 21 11:38 power lrwxrwxrwx 1 root root 0 Feb 21 11:38 subsystem -> ../../../../../class/gpio -rw-r--r-- 1 root root 4096 Feb 21 11:37 uevent -rw-r--r-- 1 root root 4096 Feb 21 11:38 value Is it possibe to enable PWM on the NanoPi Neo via sysfs?
zador.blood.stained Posted February 21, 2017 Posted February 21, 2017 Is it possibe to enable PWM on the NanoPi Neo via sysfs? Hardware PWM can be enabled only on PA05 pin: https://github.com/igorpecovnik/lib/issues/498 1
fatboyatdesk Posted February 22, 2017 Posted February 22, 2017 The above link looks to be exactly what I was looking for back in the summer and failed on. I didn't realize that if the pins were multiplexed they needed configuring in the kernel. PWM is important to me for a number of reasons. I'll be giving this a go. The link talks to legacy kernel with .fex files. I presume there is a similar tweak to Device Tree for Development kernel which I have been a bit Leary of due to there only being 24 hours in a day. Anyone able to offer some insights as to what to tweak if using the bleeding edge kernel? Thanks Allan
Thomas Pfeiffer Posted February 22, 2017 Posted February 22, 2017 If PWM does not work with the NanoPi NEO Air, maybe you could use the 16 channel PWM device PCA9685? (Just as a work around. :-) )
Recommended Posts