PWM on PYNQ_Z2 to a motor

I Need help, please How to give PWM to a motor through a digital pin on PYNQ-Z2 using PMOD or how can I do it?

@Ismael_Alejandro_Rod check this Pmod — Python productivity for Zynq (Pynq) and this pynq.lib.pmod Package — Python productivity for Zynq (Pynq). Those links should help

@Ismael_Alejandro_Rod you need something similar to this piece of code

from pynq.overlays.base import BaseOverlay
base = BaseOverlay('base.bit')
from pynq.lib import Pmod_PWM

# Select PMOD (PMODA or PMODB) and output pin (0 -7)
pwm = Pmod_PWM(base.PMODA,2)
# Set period in ms and duty cycle
pwm.generate(100,50)
# Stop PWM
pwm.stop()

PMOD pinout is shown here Pmod — Python productivity for Zynq (Pynq). Bear in mind the maximum current that these pins can provide.

Mario

thank you so much marioruiz, one question more, please. which is the maximum current that these pins of PMOD can provide?

It depends, but maximum 14 mA. https://forums.xilinx.com/t5/Welcome-Join/Max-output-current-gpio-pin-Zynq-XC7Z020/td-p/713323. You would need some kind of driver if you want higher output current.

Mario

thanks you so much marioruiz
the pins of package arduino also provide the same current ?

Yes, maximum of 14 mA.

marioruiz one question more, the period is in miliseconds(ms) or microseconds (us)?

It is in microseconds (us), more documentation here pynq.lib.pmod Package — Python productivity for Zynq (Pynq)