[Lazarus] PWM on raspberry pi

Bo Berglund bo.berglund at gmail.com
Tue Mar 8 19:50:58 CET 2016

On Mon, 07 Mar 2016 19:11:54 +0000, Mark Morgan Lloyd
<markMLl.lazarus at telemetry.co.uk> wrote:

>Two things: first, Bo on 8th Oct mentioned that he'd had to modify 
>pigpio.pas to make it compatible with the RPi2. Second, how are you 
>physically driving the system, my experience is that remote access can 

In PiGpio I added the following (roundabout line #20:


  REG_GPIO = {$IFDEF RPi2} $3F000 {$ELSE} $20000
{$ENDIF};//bcm2835/bcm2836 gpio register 0x2000 0000. new fpMap uses
page offset, one page is 4096bytes

then later down in the file (around line #150):

function TIoDriver.MapIo: boolean;
 Result := True;
 {$IFDEF RPi2}
   fd := fpopen('/dev/gpiomem', O_RdWr or O_Sync); // Open the master
/dev/memory device
   fd := fpopen('/dev/mem', O_RdWr or O_Sync); // Open the master
/dev/memory device

I do not know for a fact tha the second change is because of the RPi2
hardware, it was probably put there in order to make my program run as
a normal user rather than su.

Bo Berglund
Developer in Sweden

More information about the Lazarus mailing list