Hello everyone, 

I have come across a problem on the BBK (Debian 8.2 , 2015-09-11 release) 
and would be very grateful for a bit of an explanation. 

I need to work with the PWMs and therefore I have developed a little ugly 
script in order to work with config-pin.sh 
(https://github.com/cdsteinkuehler/beaglebone-universal-io) and then export 
the pwmchip. Down the line I'd like to to have the script running at 
start-up, prior to launching a executable.

The cape-universaln overlay is applied. The script goes as follow : 

#!/bin/bash


echo "Configuring pins"

sudo sh -c '/home/debian/beaglebone-universal-io/config-pin P9.22 pwm'
sudo sh -c '/home/debian/beaglebone-universal-io/config-pin P9.21 pwm'
sudo sh -c '/home/debian/beaglebone-universal-io/config-pin P9.14 pwm'
sudo sh -c '/home/debian/beaglebone-universal-io/config-pin P9.16 pwm'
sudo sh -c '/home/debian/beaglebone-universal-io/config-pin P8.19 pwm'
sudo sh -c '/home/debian/beaglebone-universal-io/config-pin P8.13 pwm'

echo "Export pins"
if sudo sh -c 'echo "0" > /sys/class/pwm/pwmchip0/export' ; then
        echo "pwmchip0:pwm0 exported"
else echo "pwmchip0:pwm0 export failed"
fi

if sudo sh -c 'echo "1" > /sys/class/pwm/pwmchip0/export' ; then
        echo "pwmchip0:pwm1 exported"
else echo "pwmchip0:pwm1 export failed"
fi

if sudo sh -c 'echo "0" > /sys/class/pwm/pwmchip1/export'; then
        echo "pwmchip1:pwm0 exported"
else echo "pwmchip1:pwm0 export failed"
fi

if sudo sh -c 'echo "1" > /sys/class/pwm/pwmchip1/export' ; then
        echo "pwmchip1:pwm1 exported"
else echo "pwmchip1:pwm1 export failed"
fi
 
if sudo sh -c 'echo "0" > /sys/class/pwm/pwmchip2/export'; then
        echo "pwmchip2:pwm0 exported"
else echo "pwmchip2:pwm0 export failed"
fi

if sudo sh -c 'echo "1" > /sys/class/pwm/pwmchip2/export'; then
        echo "pwmchip2:pwm1 exported"
else echo "pwmchip2:pwm1 export failed"
fi

if sudo sh -c 'echo "0" > /sys/class/pwm/pwmchip4/export'; then
        echo "pwmchip4:pwm0 exported"
else echo "pwmchip4:pwm0 export failed"
fi

if sudo sh -c 'echo "1" > /sys/class/pwm/pwmchip4/export'; then
        echo "pwmchip4:pwm1 exported"
else echo "pwmchip4:pwm1 export failed"
fi

if sudo sh -c 'echo "0" > /sys/class/pwm/pwmchip6/export'; then
        echo "pwmchip6:pwm0 exported"
else echo "pwmchip6:pwm0 export failed"
fi

if sudo sh -c 'echo "1" > /sys/class/pwm/pwmchip6/export'; then
        echo "pwmchip6:pwm1 exported"
else echo "pwmchip6:pwm1 export failed"
fi



I was happily drinking my 10th coffee when i noticed the following:

First boot: 

debian@arm:~$ cd /sys/class/pwm/
debian@arm:/sys/class/pwm$ ls
pwmchip0  pwmchip2  pwmchip4  pwmchip5  pwmchip6

Second boot:

debian@arm:~$ cd /sys/class/pwm/
debian@arm:/sys/class/pwm$ ls
pwmchip0  pwmchip1  pwmchip2  pwmchip4  pwmchip6

Firstly the result of my little script gives me a total of 7 successfully 
exported pwms. Shouldn't there be 8 ???

Secondly the numbering of the pwmchips is not consistent, and it is going 
to cause some issues when I develop the following C++ part. 

Any idea ?


Thanks in advance.

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to