PYNQ-Z1 UART sending garbage characters

Hi guys, I got a PYNQ-Z1 recently and trying to familarise myself with the platform. I’m making a very simple blinky project, to blink an LED and sending out some strings on UART0. My block diagram contains just a single PS block as below (Vivado 2021.1).


I then created an application in Vitis. Copy & paste the same piece of code I used to bring up another Zynq board.

#include “xgpiops.h”
#include “sleep.h”
int main()
{
static XGpioPs psGpioInstancePtr;
XGpioPs_Config* GpioConfigPtr;
int xStatus;
xil_printf(“Lab1 application started… \r \n”);

GpioConfigPtr = XGpioPs_LookupConfig(XPAR_PS7_GPIO_0_DEVICE_ID);
if(GpioConfigPtr == NULL)
	return XST_FAILURE;

xStatus = XGpioPs_CfgInitialize(&psGpioInstancePtr,GpioConfigPtr, GpioConfigPtr->BaseAddr);
if(XST_SUCCESS != xStatus)
	print(" PS GPIO INIT FAILED \n\r");
 XGpioPs_SetDirectionPin(&psGpioInstancePtr, 54,1);
 XGpioPs_SetOutputEnablePin(&psGpioInstancePtr, 54,1);

 while(1)
 {
	xil_printf("Lab1 application started.... \r \n");
	XGpioPs_WritePin(&psGpioInstancePtr, 54, 1);
	usleep(500000);
	XGpioPs_WritePin(&psGpioInstancePtr, 54, 0);
	usleep(500000);

 }
return 0;

}

The board was programmed successfully and I could see the LED blinking. However UART is not working as I’m just seeing garbage strings on the terminal. There is a delay between the string outputs as expected.
There must be some configuration that I’m missing in the firmware. Any idea? I have tried using the “print” function but it behaved the same.
And just to confirm when I booted the platform from the SD card with the standard Pynq image, UART and Linux worked fine.

1 Like

It’s not really a PYNQ related question. Asked in a related forum might get you a proper quick answer. Though, just sharing a thought, if you are receiving something on UART console, you might try changing the UART settings like baud rate or other stuff.

Hi, I will try the Xilinx forum too. But I feel like it may be something related to the PS CLK source of Pynq. Pynq uses 50MHz while my other board uses 33MHz.
The baud rate I used in my console was 115200, but I have tried all other baud rate options too, no luck.

@Hak_Son

What voltage level you had set in the ZYNQ Bank?
What UART USB adapter you used?
Any additional setting expanding the UART0 MIO14:15?

Enjoy

I’m using LVCMOS 3.3V for the banks and UART.

I’m using the 2 UART0 pins (pin 14 &15) which I presume are connected to the on-board FT2232 adapter. Unfortunately details of the connection are hidden from the schematics. So basically I’m trying to get UART output from the micro-usb port on the board.

1 Like

@Hak_Son

Remember, PYNQ-Z1 power might not be enough if this is not connected to DC Jack powering.
This is commonly what user will encountered on many low-end FPGA.
5V 500mA with cable lost, DC-DC lost.

Try DC Jack powering first, plug in USB cable later.
And hot reset via button and see this is the case.

It is also worth mentioned that if SD card is bad brand.
Try lower the SD Card SDIO speed to 20M or less and see.

Enjoy~

So I changed the jumper and powered the board with an external 12V brick supply. Still doesn’t work :frowning:.
I’m programming the Zynq through Vitis so I’m not using the SD card here. I’m running out of idea so please let me know if there’s something else I could try. Thanks.

@Hak_Son

Can you simply used the example project HelloWorld inside the Vitis?
This will not require user to modify any code and simply build and run via JTAG.
If you had no idea how to do so, then you got to change your questioning to Xilinx forum.
While there could be chance that board goes faulty (shipping or any unexpected case) but chance are low.

I am helping out here due to PYNQ-Z1 board but the content as @mizan proposed is out of PYNQ Python ground nor the PYNQ environment itself.

Enjoy~

Sure. Thanks for the help. I will put my question to the Xilinx forum. Sorry I didn’t realise this forum was mainly for Python and the software environment.

1 Like