Bosse_B
Posts: 891
Joined: Thu Jan 30, 2014 9:53 am

PiGpio FPC driver class for the Pi2?

Thu Oct 08, 2015 9:07 pm

I have a need to set outputs on GPIO in a FreePascal program. Must pull two relays.
I found this documentation page for a driver called pigpio and it seems to do basically all I need, however it is specifically written for the BroadComm BCM2835 chip used in the previous models of the Pi.
Now with the pi2 and its bigger I/O connector I am assuming an update needs to be found...
Has anyone here managed to control GPIO pins from FreePascal using the pigpio.pas file?
Is there an update somewhere?
Bo Berglund
Sweden

User avatar
joan
Posts: 14698
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: PiGpio FPC driver class for the Pi2?

Thu Oct 08, 2015 10:02 pm

This is nothing to do with my pigpio library.

For the Pascal unit I would see if changing

Code: Select all

REG_GPIO = $20000;//bcm2835 gpio register 0x2000 0000. new fpMap uses page offset, one page is 4096bytes
to

Code: Select all

REG_GPIO = $3F000;//bcm2835 gpio register 0x3F00 0000. new fpMap uses page offset, one page is 4096bytes
lets it work for the Pi2.

Bosse_B
Posts: 891
Joined: Thu Jan 30, 2014 9:53 am

Re: PiGpio FPC driver class for the Pi2?

Sat Oct 10, 2015 10:14 pm

Just to close this thread:
I used your advice on both counts (second one given in another thread):
1) Redefine the address depending on Pi1 or Pi2 using a conditional define
2) Change the device from /dev/mem to /dev/gpiomem, which can be used by user pi without root

The example program now works in my incarnation on a trunk version of FreePascal and Lazarus running on the latest Raspbian Jessie.
I am good to go!
Thanks!
Bo Berglund
Sweden

Return to “Other programming languages”