[Lazarus] PWM on raspberry pi
Koenraad Lelong
lazarus2 at de-brouwerij.be
Mon Mar 7 22:34:34 CET 2016
Op 07-03-16 om 20:11 schreef Mark Morgan Lloyd:
> Koenraad Lelong wrote:
>> 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".
>
> 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
> be less reliable than using the directly connected screen and keyboard
> particularly when single-stepping.
>
I think the modifications I mentioned are what is needed (in and out works).
I did all this on the pi itself, no remote.
Koenraad.
More information about the Lazarus
mailing list