tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: gpio(4) and pulsing pins in software



Am 29.09.11 09:39, schrieb Reinoud Zandijk:
> Hi Marc,
> 
> On Wed, Sep 28, 2011 at 10:05:31PM +0200, Marc Balmer wrote:
>> Marc....
> 
> sorry :-D
> 
>>> On Sun, Sep 25, 2011 at 11:42:11AM +0200, Marc Balmer wrote:
>>> I'd like to be able to set the PWM indepentently for each pin! say 
>>> specifying
>>> 70/256 on and otherwise off.
>>
>> That is what gpiopwm(4) is for.
>>
>>> gpiopwm(4) can be grouped on pins that needs synchronisation. Say gpiopwm0 @
>>> gpio0 has pins 3, 5, 7 with each their pwm's but synchronised on 'on' or 
>>> 'off'
>>> and gpiopwm1 @ gpio0 has pin 2 and 8. As they are synchronised all the pins
>>> attached can be programmed at one go preventing arbitrary races.
>>
>> How can you sync if the pins have different duty cycles?
> 
> Well they could all start at the same time, say a pin0 @ 70/256 and a pin1 @
> 45/256 can start both at t=0 and pin1 dropping at t=44 and pin0 dropping at
> t=69 and both keeping low until t=256.
> 
> The base duty cycle will then be the same for say a gpiopwm0, only different 
> portions of the
> time on/off for the pins connected to gpiopwn0.
> 
> Is this more clear?

Yes, I understand now what you mean, but that is not PWM anymore.  A
duty cycle repeats itself all the time.  What you describe is more of a
repeated single-shot.

I will first do what I have now, PWM.  Such a single shot thingie could
be shoehorned into it later, now that we have flags.

> 
> With regards,
> Reinoud
> 



Home | Main Index | Thread Index | Old Index