Jump to content

NanoPi Neo PWM pin


OldMan

Recommended Posts

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?

 
Link to comment
Share on other sites

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

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines