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 28.09.11 16:08, schrieb Reinoud Zandijk:
> Hi Mark, hi folks,


> On Sun, Sep 25, 2011 at 11:42:11AM +0200, Marc Balmer wrote:
>> attached to an individual pin.  gpioctl(8) will keep the pulse keyword,
>> as this is needed for hardware pulsating devices.  The interface to the
>> gpiopwm(4) driver could be realized using three sysctl variables:
>> hw.gpiopwm0.running=0 # Set to 1 to start pwm
>> hw.gpiopwm0.ticks_on=n1 # Number of ticks the pin is 1
>> hw.gpiopwm0.ticks_off=n2 # Number of ticks the pin is 0
>> The current implementation is kind of a hack, since I need a callout_t
>> and two integers per pin, if they pulse or not.  Memory is certainly not
>> the problem, but I think it's gross nonetheless.
> 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?

> I think it would make the system a lot more powerfull without having clutches
> around. Each gpiopwm(4) instance can then have one timer callback and do all
> the pin transitions; could be optimised to be even called X pulses later when
> the next transition is due.
> With regards,
> Reinoud

Home | Main Index | Thread Index | Old Index