I've got the following tricky problem: I'm using pin #22 (GPIO25) of my Raspi 3B as a GPIO input and read its state by using the pigpio function gpioSetAlertFunc (25, relay::IgnitionISR), where relay::IgnitionISR is a pointer to the function called when pigpio detects a state change. After adding a JustBoom DAC HAT sound card, the input kept on working, but once I started talking to the sound card by using the out123_open (sound::mp3_output_handle, "alsa", NULL) function of the mpg123 library, I stopped receiving alerts from pin #22 without getting any error messages.

The pinout description of the sound card states pin #22 as optional (for use with an IR receiver). I don't have such a receiver soldered to the sound card, so that I don't really understand why the card interferes with a pin it isn't using anyway.

Low-level checks by using gpio readall and piscope did deliver correct resoluts: Once I pulled pin #22 to high, I received a 1, and a 0 when I pulled it to low.

Any hints? Thank you for any useful information.

  • 1
    I guess the HAT uses PCM. pigpio uses PCM to time sampling so the use will clash. If you are using the pigpio daemon try starting with the -t0 option to use PWM for timing instead of PCM. abyz.me.uk/rpi/pigpio/pigpiod.html – joan Apr 1 '18 at 13:56
  • No, I am currently using pigpio directly, but for the production version of my solution, I might migrete to pigpiod. Is there also a method to switch to PWM in pigpio itself? – Neppomuk Apr 1 '18 at 20:26
  • 1
    Yes, use abyz.me.uk/rpi/pigpio/cif.html#gpioCfgClock before calling gpioInitialise(). – joan Apr 1 '18 at 20:30
  • Yep, it works. You can now make an answer out of your comment. – Neppomuk Apr 13 '18 at 20:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.