[Lazarus] PWM on raspberry pi

Koenraad Lelong lazarus2 at de-brouwerij.be
Mon Mar 7 19:15:29 CET 2016


Hi,

I'm trying to configure a PWM-pin on the raspberry pi 2. I'm using 
pigpio, with the demo-program.
I configured pin 12 (GPIO 18) to be a PWM pin.
When I click the PWM-button on the demo-program, the pi hangs. I have to 
power-cycle to "recover".
I modified this:
   REG_GPIO = $3F000;
and this :
  fd := fpopen('/dev/gpiomem', O_RdWr or O_Sync); // Open the master 
/dev/memory device

I'm trying to debug this :
       delayNanoseconds(200); <-- breakpoint
       pwmf := Pointer(LongWord(Self.FPwm)+PWM0_RANGE);
       pwmf^ := $400 ;                             //max: 1023
       delayNanoseconds(200);
       pwmf := Pointer(LongWord(Self.FPwm)+PWM1_RANGE);
       pwmf^ := $400 ;                             //max: 1023
       delayNanoseconds(200);
Stepping further with F8.
When I press F8 on the first
       pwmf^ := $400;
the code "singe steps" automatically, but after a number of steps the 
application crashes and the pi hangs.
This is different from normally running the application where the 
application just hangs after pressing the PWM-button.

Input and output works fine, as user "pi".

Any thoughts ?

Thanks,

Koenraad.




More information about the Lazarus mailing list