Difference between revisions of "Pigpio"

From Autopilot Wiki
Jump to: navigation, search
 
Line 1: Line 1:
* [[Has PyPI Package::pigpio]]
+
* '''PyPI''': [[Has PyPI Package::pigpio]]
* [[Has Git Repository::https://github.com/joan2937/pigpio]]
+
* '''Repository''': [[Has Git Repository::https://github.com/joan2937/pigpio]]
* [[Has Documentation::http://abyz.me.uk/rpi/pigpio/]]
+
* '''Docs''': [[Has Documentation::http://abyz.me.uk/rpi/pigpio/]]
 +
 
 +
Pigpio is a C package with Python binding that Autopilot uses as its primary [[GPIO]] controller. It has advantages and disadvantages relative to something simpler like the typical [[RPi.GPIO]] package or [[gpiozero]] - eg. the ability to have better access to things like [[DMA]] for [[PWM]], running scripts, waveforms, and so on. The disadvantages are that it is a relatively unwieldy process that doesn't die neatly, and it can cause some unexpected behaviors when care is not taken to configure it for your use. Read the docs for pigpio and edit the <code>PIGPIOARGS</code> [[Autopilot Prefs|Pref]] accordingly.
 +
 
 +
== [[Troubleshooting]] ==
 +
 
 +
* [[Audio]]: https://github.com/auto-pi-lot/autopilot/issues/199#issuecomment-1424525314
 +
** '''Problem:''' from [[Has Contributor::Chris Rodgers]], allowing pigpio to have control over the PCM clock can have unpredictable consequences on the audio server as it will try to use PWM or another clock in the system. In this case, playing with incorrect sampling rates.
 +
** '''Fix:''' If using audio with pigpio, use the <code>-t 0</code> to set the clock used by pigpiod to [[PWM]]], leaving the [[PCM]] clock free for an external sound card like the various [[HiFiBerry]] cards.
  
 
== Examples ==
 
== Examples ==

Latest revision as of 10:28, 10 February 2023

Pigpio is a C package with Python binding that Autopilot uses as its primary GPIO controller. It has advantages and disadvantages relative to something simpler like the typical RPi.GPIO package or gpiozero - eg. the ability to have better access to things like DMA for PWM, running scripts, waveforms, and so on. The disadvantages are that it is a relatively unwieldy process that doesn't die neatly, and it can cause some unexpected behaviors when care is not taken to configure it for your use. Read the docs for pigpio and edit the PIGPIOARGS Pref accordingly.

Troubleshooting

  • Audio: https://github.com/auto-pi-lot/autopilot/issues/199#issuecomment-1424525314
    • Problem: from Chris Rodgers, allowing pigpio to have control over the PCM clock can have unpredictable consequences on the audio server as it will try to use PWM or another clock in the system. In this case, playing with incorrect sampling rates.
    • Fix: If using audio with pigpio, use the -t 0 to set the clock used by pigpiod to PWM], leaving the PCM clock free for an external sound card like the various HiFiBerry cards.

Examples