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 https://pynq.readthedocs.io/en/v2.5.1/pynq_libraries/pmod.html and this https://pynq.readthedocs.io/en/v2.5.1/pynq_package/pynq.lib/pynq.lib.pmod.html#module-pynq.lib.pmod.pmod_pwm. 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 https://pynq.readthedocs.io/en/v2.5.1/pynq_libraries/pmod.html#examples. Bear in mind the maximum current that these pins can provide.
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.
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 https://pynq.readthedocs.io/en/v2.5.1/pynq_package/pynq.lib/pynq.lib.pmod.html#module-pynq.lib.pmod.pmod_pwm