0

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:

NativeMethods.Waves.GpioWaveClear()
NativeMethods.Waves.GpioWaveAddGeneric()
NativeMethods.Waves.GpioWaveCreate()
0

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 Dec 4 '19 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 Dec 5 '19 at 10:20
  • p.s. I consider this an advanced usage and you probably need to be a fairly experienced algorithm designer. – joan Dec 5 '19 at 10:21

Your Answer

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

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