I'm using a dedicated library to run a ws2812 led strip. As far as I understand, this library sends a signal using the hardware PWM, via GPIO pin 18. This works fine and the led strip shows the colors I want.

Then I got to work using pigpio in order to bitbang a series of SPI boards connected to the pi (MCP3008 & MCP23s17) This also works, but as soon as I call any of the pigpio wave send functions to do this, the led signal gets completely scrambled, and I get the first 25 leds of the strip showing random colors.

This effect lasts as long as the program runs. I can't get a proper led signal trough untill I stop the code and run it again (without the send wave calls).

The function I'm talking about is the following, the wave I'm sending regards different GPIO pins.

gpioWaveTxSend(waveID, PI_WAVE_MODE_ONE_SHOT);

Note also the documentation contains the line "Any hardware PWM started by gpioHardwarePWM will be cancelled.", so it's obvious this function interferes with hardware PWM somehow.

So my question is what exactly pigpio does here, and is there a workaround? I was also looking for manually creating a hardware PWM signal, but pigpio only seems to allow a constant repeating signal (which amusingly I can use to set all my leds to pure white).

2 Answers 2


pigpio always uses either the Pi's hardware PWM or hardware PCM peripherals to perform GPIO sampling and to generate PWM pulses.

If you use waves or hardware PWM then both peripherals will be used by pigpio.


There is no workaround.


You can get both to work by terminating and reinitializing both pigpio and the ledstrip library, something like this;

  gpioSetMode(pin, mode);
  gpioWaveTxSend(waveID, PI_WAVE_MODE_ONE_SHOT);


The gpio init is the bottleneck here, which takes about 0.35s on my pi4, which is way too slow for my application. I'm posting the answer anyway in case it is useful to someone else.

Your Answer

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

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