Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2016-07

Re: GPIO for pi

6 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Koenraad Lelong

Op 27-07-16 om 15:52 schreef Bo Berglund:

Show quoted text 18 lines
Thanks, I unpacked the zip in my Projects dir on a Raspberry Pi3 running Raspbian. Did nothing else to the files. Then opened the project in Lazarus 1.6 (with FPC 3.0) and executed a compile command. I received an error message so I repeated it again and the same error appeared: Compile Project, Target: x_pigpiod_if2: Exit code 256, Errors: 1 /usr/bin/ld: warning: link.res contains output sections; did you forget -T? /usr/bin/ld: cannot find -lpigpiod_if2 x_pigpiod_if2.lpr(21,0) Error: Error while linking Is this a project that requires the presence of some other binary packages or libraries? Like pigpiod_if2.... Best Regards, Bo Berglund

Bo,

I have following files on the pi :
/usr/lib/libpigpio.so
/usr/lib/libpigpiod_if2.so

Do you have these ? I'm running the latest raspbian-image (2016-05-27-raspbian-jessie.img).
You could also download the library from
http://abyz.co.uk/rpi/pigpio/index.html and compile and install that.

To use the library, you need of course enable the gpio-server (raspi-config/advanced options). Or manually start it when you have an older (or different ?) OS-version.

HTH

Koenraad.

Reply by email

Bo Berglund
to Koenraad Lelong
Koenraad Lelong wrote 33 lines
Op 27-07-16 om 15:52 schreef Bo Berglund: > Thanks, > I unpacked the zip in my Projects dir on a Raspberry Pi3 running Raspbian. > Did nothing else to the files. > > Then opened the project in Lazarus 1.6 (with FPC 3.0) and executed a compile command. > I received an error message so I repeated it again and the same error appeared: > > Compile Project, Target: x_pigpiod_if2: Exit code 256, Errors: 1 > /usr/bin/ld: warning: link.res contains output sections; did you forget -T? > /usr/bin/ld: cannot find -lpigpiod_if2 > x_pigpiod_if2.lpr(21,0) Error: Error while linking > > Is this a project that requires the presence of some other binary packages or libraries? > Like pigpiod_if2.... > > Best Regards, > > Bo Berglund Bo, I have following files on the pi : /usr/lib/libpigpio.so /usr/lib/libpigpiod_if2.so Do you have these ? I'm running the latest raspbian-image (2016-05-27-raspbian-jessie.img). You could also download the library from http://abyz.co.uk/rpi/pigpio/index.html and compile and install that. To use the library, you need of course enable the gpio-server (raspi-config/advanced options). Or manually start it when you have an older (or different ?) OS-version.

I was running a Pi3 with the March Raspbian image. I am doing the upgrade now.
Let's see what happens.

Bo Berglund Developer in Sweden

Reply by email

Bo Berglund
to Bo Berglund
Bo Berglund wrote 12 lines
>Do you have these ? I'm running the latest raspbian-image >(2016-05-27-raspbian-jessie.img). >You could also download the library from >http://abyz.co.uk/rpi/pigpio/index.html and compile and install that. > >To use the library, you need of course enable the gpio-server >(raspi-config/advanced options). Or manually start it when you have an >older (or different ?) OS-version. I was running a Pi3 with the March Raspbian image. I am doing the upgrade now. Let's see what happens.

Now done updating Raspbian to latest version.
And the project compiles!

If it works is another story because I do not understand what to do with a form with a long list of checkboxes without explanation...

Bo Berglund Developer in Sweden

Reply by email

Koenraad Lelong
to Bo Berglund

Op 28-07-16 om 00:59 schreef Bo Berglund:

Show quoted text 12 lines
On Wed, 27 Jul 2016 21:43:10 +0200, Bo Berglund wrote: Now done updating Raspbian to latest version. And the project compiles! If it works is another story because I do not understand what to do with a form with a long list of checkboxes without explanation...

The program is a demo/test program. It's the gui-fied version of x_pigpiod_if2.c.
Remove any IO from the pi, and then just press the Test-button. The program then tests all functions (tests a through c are not implemented yet, because I don't have the extra hardware, like SPI or I2C devices). All tests should display 'PASS', there are sub-tests. Output is like this :
Connected to pigpio daemon 0
Testing pigpiod C I/F 2
pigpio version 54
Hardware revision 10489921
Mode/PUD/read/write tests
TEST 1.1 PASS (set mode, get mode: 0)
TEST 1.2 PASS (set pull up down, read: 1)
TEST 1.3 PASS (set pull up down, read: 0)
TEST 1.4 PASS (write, get mode: 1)
TEST 1.5 PASS (read: 0)
TEST 1.6 PASS (write, read: 1)
PWM dutycycle/range/frequency tests.
...

Remember to program the IP-address of your pi at the start of the Test-button OnClick event, in the parameters of the pigpio_start call. That has to be the x.x.x.x form. 127.0.0.1 should work if you run the application on the pi itself.

The c-version uses pigpio_start(0, 0) where those 0's mean 'default values', which are ip-address 127.0.0.1 and port 8888. I tried to replace those by
pigpio_start(PChar(#0), PChar(#0)) or
pigpio_start(PChar(''), PChar(''))
Both didn't work, so I hardcoded these values.

I'll ammend the application so users should input the address and port on the form, and give a warning to remove any IO from the pi.

Koenraad

Reply by email

Bo Berglund
to Koenraad Lelong
Koenraad Lelong wrote
I'll ammend the application so users should input the address and port on the form, and give a warning to remove any IO from the pi.

Thanks,
I received the updated project with the explanation for each test added.
I put this into a separate directory and opened it and it compiled/built fine without errors.
But when I hit the Green run button in Lazarus I get an error box saying that the debugger entered the error state.
More info is:

The GDB command:
"-gdb-set confirm off"
did not return any result.

This did not happen last time I tested after doing a dist-upgrade to get the GPIO service installed. Now I have also rebooted the Pi and now both the previous and this new version exhibit this error. So it seems like the Raspbian upgrade has hosed my Lazarus environment.

Did you see this too?

Bo Berglund Developer in Sweden

Reply by email

Koenraad Lelong
to Bo Berglund

Op 28-07-16 om 21:53 schreef Bo Berglund:

Show quoted text 27 lines
On Thu, 28 Jul 2016 09:12:53 +0200, Koenraad Lelong wrote: > I'll ammend the application so users should input the address and port > on the form, and give a warning to remove any IO from the pi. > Thanks, I received the updated project with the explanation for each test added. I put this into a separate directory and opened it and it compiled/built fine without errors. But when I hit the Green run button in Lazarus I get an error box saying that the debugger entered the error state. More info is: The GDB command: "-gdb-set confirm off" did not return any result. This did not happen last time I tested after doing a dist-upgrade to get the GPIO service installed. Now I have also rebooted the Pi and now both the previous and this new version exhibit this error. So it seems like the Raspbian upgrade has hosed my Lazarus environment. Did you see this too?

No, I can run the application from within lazarus. Could you try to run the application 'stand-alone' ? FWIW, I have two different lazarus-versions on that pi, both from fcpup, but different versions of both fpc and lazarus. Both work. From the about-boxes :
First :
Lazarus 1.5 (2015-11-06)
fpc 3.1.1
Second
Lazarus 1.6RC1 (2015-12-17)
fpc 3.0.0

Koenraad.

Reply by email