In PYNQ, there is UART (0 or 1) in the PS side. If the user use the UART on PYNQ to communicate with other board, it needs to have the UART driver code on the PYNQ. From the existing PYNQ doc and library code, I don’t find any python example code for UART control but GPIO and IIC etc.
However, I found the following library pySerial for UART control SW. As you know, can we install the pySerial package on the Linux on PYNQ for the UART control of PYNQ ?
Or user needs to write the UART driver code for the PYNQ.
Or where can user find the python example code for UART control on PYNQ.
You can try it out on ipython microblaze; I think I did some testing in the past - it worked. You can do some testing with the base overlay, where microblaze is controlling the uart.
Actually, we would like to use the uart on ARM CPU instead of microblaze on PYNQ in the original plan. Do you know if there has any python UART example on ARM CPU on PYNQ ?
Yes, I’ve achieved this by using the serial Python package. When connected to the PYNQ’s USB HOST, your device should be visible at the OS-level on the board (e.g., as /dev/ttyUSB0 ). Then you can write a script that initializes your UART/serial bus like so:
ser = serial.Serial(’/dev/ttyUSB0’, baudrate=9600, timeout=0.5)
Data can then be sent & received using the methods:
If you are looking to establish UART communication for a device that is not connected to the USB HOST interface, though, you will need to go through the PL – easiest way to do this is using the MicroblazeLibrary class as a wrapper for the UART API implemented in ‘uart.c’.