Close

flicker free software-PWM for the backlight

A project log for PiBoy-Zero

yet another portable console! ;-) roughly the size of a gameboy micro, with a 2.2" display

johschneiderJohSchneider 03/15/2016 at 19:170 Comments

just using wiring-pi or the python GPIO classes to drive a software pin did work, but tended to flicker ever so often - since there is so much software overhead involved and the kernel rescheduling the python process :P

what seems to work much better is a software-pwm that uses the hardware PWM/PCM subsystem of the broadcom chip - like

https://github.com/sarfata/pi-blaster/

with some minor modifications to the source and the '-pcm' switch set (can't use the PWM subsystem, since it will be busy generating audio) the LED (used as placeholder for the backlight circuit) stopped flickering :-D

NB: there is another trade-off: by using the PCM subsystem for software-pwm we lose the serial-console. so if one needs the (hardware)serial to debug, the backlight service has to be disabled

Discussions