[Lazarus] Raspberry Pi Debug Digital I/O

Koenraad Lelong lazarus2 at de-brouwerij.be
Sun Jan 24 20:59:40 CET 2016


Op 24-01-16 om 11:47 schreef Bo Berglund:
> On Fri, 22 Jan 2016 20:55:59 -0500, Donald Ziesig <donald at ziesig.org>
> wrote:
>
>> The application itself must run as root to do digital I/O.  If you don't
>> want to debug using the IDE, you don't have to make the IDE run as root,
>> though, just the app.
>
> I do not think this is necessary!
>
Strange,

I tried this with my test-application and it does not work as user 'pi'.
I investigated a little bit further.
No application running :
root at raspberrypi:/home/pi/Documents/lazarus/pascalio/koen-test# ls -l 
/sys/class/gpio
totaal 0
-rwxrwx--- 1 root gpio 4096 jan 22 22:03 export
lrwxrwxrwx 1 root gpio    0 jan 22 22:03 gpiochip0 -> 
../../devices/platform/soc/3f200000.gpio/gpio/gpiochip0
-rwxrwx--- 1 root gpio 4096 jan 22 22:03 unexport

When I run the application as 'pi', I get this :

root at raspberrypi:/home/pi/Documents/lazarus/pascalio/koen-test# ls -l 
/sys/class/gpio
totaal 0
-rwxrwx--- 1 root gpio 4096 jan 22 22:03 export
lrwxrwxrwx 1 root gpio    0 jan 24 19:43 gpio17 -> 
../../devices/platform/soc/3f200000.gpio/gpio/gpio17
lrwxrwxrwx 1 root gpio    0 jan 24 19:43 gpio18 -> 
../../devices/platform/soc/3f200000.gpio/gpio/gpio18
lrwxrwxrwx 1 root gpio    0 jan 22 22:03 gpiochip0 -> 
../../devices/platform/soc/3f200000.gpio/gpio/gpiochip0
-rwxrwx--- 1 root gpio 4096 jan 22 22:03 unexport
root at raspberrypi:/home/pi/Documents/lazarus/pascalio/koen-test#

But the IO does not work. When I do
echo 1 > /sys/class/gpio/gpio17/value
from the command-line, the IO does not work, even when I do this as root.

When I run the application as root, everything works as expected.

B.T.W. what 'library' are you using for the GPIO's ?

Koenraad





More information about the Lazarus mailing list