I'm driving a stepper motor with a PI4B and pigpio / Unosquare.PiGpio library for .NET. I'm using the wave module to modulate the pulse to drive the stepper motor. This works pretty good, until I reach about 12k pulses (gpioWaveGetMaxPulses). Then I get the error PI_TOO_MANY_CBS (What does CBS even mean?) Is there any way of chaining waves to get more than 12k pulses? I tried to use the gpioWaveChain method, but I get the error already when setting up the waves with GpioWaveAddGeneric.

This is my current call chain:


2 Answers 2


You have hit a sizing limit. pigpio allocates a fixed amount of memory to serve as storage space for CBs (Control Block).

You could change the limit in the code but that is not straightforward and would likely require a great deal of study on your part.

A CB is the basic structure of DMA tranfer. It says copy this many words from source to destination. CBs can be chained together and timed. In the case of steppers the CBs would be used to copy data to GPIO memory to switch GPIO on and off at the required times.

  • Thanks for your quick response, do you have another idea, apart from increasing the CB size, how I can chain more waves?
    – Ksdmg
    Commented Dec 4, 2019 at 18:18
  • What I would do (if possible) is calculate a wave of about 3000 CBs and send that. When that is being sent calculate another of the same size and send that with the sync with flag. Then start calculating the next block of CBs. When the first wave is finished delete that wave and keep repeating that process. Look at abyz.me.uk/rpi/pigpio/cif.html#gpioWaveTxAt to work out when a wave is being sent/has completed.
    – joan
    Commented Dec 5, 2019 at 10:20
  • p.s. I consider this an advanced usage and you probably need to be a fairly experienced algorithm designer.
    – joan
    Commented Dec 5, 2019 at 10:21

I was able to reduce the problem by splitting the move of a stepper motor in tree phases: Acceleration, Cruising and Deceleration. For the cruising part I use the possibility of looping (255,0 + 255,1 in gpioWaveChain). Only for acceleration and deceleration I have to generate a number of waves.

Thanks to PigPio I am now able to control stepper motors without interruptions from OS (important when used in a 3D-printer).

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.