Port-arm archive

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

Support for PWM on RPI3 GPIO



Howdy folks…

I have a little project I’m working on that uses a Nixie tube display, and I’m planning use a RPI3 running NetBSD to drive the whole thing.  (It’s total overkill, but that’s part of the appeal :-)

One of my requirements is that I need a way to vary the brightness of the display in response to ambient light.  I have the ambient light sensor bit figured out, and the display brightness control is going to be achieved by switching the high voltage supply using a pair of NPN transistors arranged such that driving the base of one of the transistors effectively disconnects the high voltage supply from the anodes of the Nixies.  Thus to control the brightness, I need to pulse-width modulate the GPIO pin driving that transistor (the longer the duty cycle of the GPIO pin, the dimmer the display).

I know about the gpiopwm driver[*] … but the RPI3 has hardware PWM support on one of the GPIO pins (GPIO18), and I’d prefer to use this rather than soft PWM because I want to minimize any jitter in the timing that would cause display brightness artifacts, and the PWM frequency range I need would also require me to use a different hard clock frequency (looks like HZ=100 is still the default?)

I see there’s a “bcmpwm” driver, but I’m not sure it’s what I want… Nothing appears to actually use it, as far as I can tell, and there doesn’t seem to be any API *to* use it, nor any obvious documentation on its function.

Anybody have some advice for me?

Thx.

[*] BTW, it’s really unfortunate that the gpiopwm driver specifies the on and off periods in “ticks”.  Milliseconds (with an always-round-up policy) would have been a much better unit to use.

-- thorpej




Home | Main Index | Thread Index | Old Index