I am working with a simple hardware design that requires the generation of 3 different square waves on different GPIO pins of the Raspberry Pi 3.
I have reviewed posts such as this one:
and have had great success in generating a single square wave on a GPIO of my choice, at a frequency I specify. So far so good. I've tested with pigpio and RPi.GPIO, and am getting the best results in pigpio so far - however I am open minded about which library I use. I am writing in Python but again if there is a better way to achieve this I have no issues writing a C program or similar.
Where I have come unstuck is generation of two or more square waves at the same time. Let's say that I want:
- 100Hz 50% duty cycle generated on GPIO17.
- 16Hz 50% duty cycle generated on GPIO18.
I haven't found a way to do this. For example the pigpio documentation for the wave_send_repeat function (http://abyz.me.uk/rpi/pigpio/python.html#wave_send_repeat) says:
Transmits the waveform with id wave_id. The waveform repeats until wave_tx_stop is called or another call to wave_send_* is made.
This is my experience. I've tried the wave_chain function with similar results - I can't get the two square waves to transmit simultaneously, even though I can define them and transmit one at a time.
Suggests a method closer to that which I want, but I don't need the phase syncing - that isn't important for my application - I just need to send two independent waves regardless of phase angle.
I feel like I'm missing something, or perhaps I've struggling with the hardware capabilities of the BCM chip and asking for something it wasn't designed for. Can anyone please point me in the right direction?
Thanks in advance!