1

I am using a Raspberry Pi 3 B+. I want to play audio through the 3.5mm jack and use PWM at the same time or successively to simulate a IR-Remote. I know that you can't use the hardware PWM while playing audio, becouse the 3.5mm jack uses the hardware PWM to generate the analog audio output.

I use the pigpio library (in a code similar to this) to generate and send a wave to the IR-Led (on pin 22). I read on other pages, that pigpio uses DMA to send the wave signal and thus should not need the hardware PWM.

Still when I send the wave to the GPIO the audio crashes and I need to reboot the Raspberry Pi to get the audio working again.

So my question is, why does the audio output crash when sending the wave although pigpio don't use the hardware PWM (or did I get that wrong) and how can I prevent that crash?
If I can't prevent that crash how can I restart the audio system to play some audio after sending a wave to the GPIO.

Edit:
Although I found different informations about the use of hardware PWM in the pigpio library, the wave function uses the hardware PWM and you can't use audio at the same time.
Now my question is how can I switch back to "audio mode" after using the GPIOs with PWM?

1 Answer 1

1

pigpio uses one of the PWM or PCM peripherals to time the sampling of GPIO (defaults to PCM).

If waves are used then the other peripheral will be used for their timing - so there will be no audio support.

See pigpio sound isn't working.

2
  • Ok. But how can I switch between audio and PWM? Or how can I restart the audio after using pigpios PWM?
    – Luis
    Nov 3, 2019 at 9:58
  • I don't know. I don't use audio on the Pi.
    – joan
    Nov 3, 2019 at 10:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.