4

The Python package pigpio has a wave_chain() method that allows one to chain together a series of waveforms in an easy-to define looping structure. But the GPIO chip itself has quite a limited number of 32-byte registers.

Is the CPU executing this loop, swapping out one waveform after another? Is it for example alternating between a pair of GPIO registers (e.g. the two PWM DATA registers); writing to one while the other is being clocked through by the GPIO internals? Or is the loop somehow executed within the GPIO itself?

Will RPi CPU overhead lead to occasional, unpredictable pauses and delays?

4

The Raspberry Pi has 16 hardware DMA (Direct Memory Access) channels.

Using DMA you can copy the contents of memory from one memory address to another memory address without software involvement. The hardware allows you to chain many transfers together such that the next is automatically started when the previous has finished. You can also pace (i.e. time) the transfers using either the PWM or PCM hardware.

pigpio uses these features to create waves, whereby blocks of memory are periodically copied to the GPIO output registers which sets the levels of GPIO 0-31.

This means you can switch any combination of GPIO 0-31 on and off at controlled intervals.

  • OK based on your answer, I can see that the wording of my question is not a good fit to how the SOC is actually designed, but despite that you've explained what I needed to hear. Thanks! – uhoh Dec 28 '17 at 9:05

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.