Pmod PWM Generate signal on multiple pins

I’m trying to generate separate PWM signals on multiple Pmod pins.
I don’t think that the library is meant to support this scenario as I can only reliably get a PWM signal on a single pin. Do you know of any workaround for this ?

This is my naive attempt:

from pynq.lib import Pmod_PWM

pwm = Pmod_PWM(base.PMODA,0)
pwm2 = Pmod_PWM(base.PMODA,1)

import time



It seems like Pmod_PWM re-inits the whole Pmod module and the configuration before that is lost.

To sum it up I’m trying to generate 3 individual PWM signals on PmodA pins (for example 1,2,3) following the example from /base/pmod/pmod_pwm.ipynb .

Using the Pynq-Z1 board with the prebuilt 2.6.1 SDCard image from the site.

Yes, you are right, it isn’t really intended to be used like this.
There are a few ways you could do this depending on what you need exactly.

Could you use the logictools pattern generator?:


The pattern generator looks interesting and is a thoughtful suggestion. I’m currently looking into it. I need to generate control PWM signals for a 3-phase motor control drivers. That’s why I need 3 separate PWM signals one for each motor phase. The signals also need to be dephased by 120 degrees.

Oddly enough I’ve done the pattern generator demo and it worked fine when I was using jumpers for the analyzer part. After that I’ve attached a scope to 2 of the outputs and the voltage changes are in the realm of millivolts instead of a few volts as it was with the Pmod PWM output. Am I missing something, the output signal looked more like noise on the scope rather than a clean rectangular waveform ?

I’m not sure if this is possible entirely from python but I thought I’d ask before having to resort to the big boys - Vitis/Vivado. If I can scrape a solution (even as a proof of concept) without having to implement my own IP that would be ideal. But if making an IP is the only solution I guess it’s better to know sooner rather than later. I’m counting on your expertise and better understanding of the platform. Thank you :slight_smile:

I thought the outputs should be 3.3V on PYNQ-Z2. Perhaps something is going wrong - sending output to wrong pins, or scope on wrong pins?