Hello, I want to use uart in pynq, it is okey to use uart in rpi interface, but how could we use it in ardunio or pmod?
For the Arduino interface, you can use the MicroblazeLibrary class to create a wrapper object in Python that exposes the functions implemented in the PYNQ UART API (in ‘uart.c’). Here’s a very basic example of its usage:
from pynq import Overlay
from pynq.lib import MicroblazeLibrary
UART_RXD = 0 ## Arduino pin 0 is RXD
UART_TXD = 1 ## Arduino pin 1 is TXD
base = Overlay(‘base.bit’)
lib = MicroblazeLibrary(base.iop_arduino, [‘uart’])
uart = lib.uart_open(UART_TXD, UART_RXD)
read_command = [0xDE, 0xAD, 0xBE, 0xEF]
uart.write(read_command, len(read_command)) ## Write an iterable list of bytes
response = [0x00] * 4
uart.read(response, 4) ## Request a 4-byte response
I don’t believe either of the two Pmod PYNQ Microblaze IOPs have an AXI controller for UART, so Pmod UART may not be supported.