PYNQ: PYTHON PRODUCTIVITY

Activate UART1 with a Device Tree Overlay

Board: PYNQ-Z2

Pynq image version: 2.6.0, no modifications (other than an pynq overlay folder for the DTO)

I am attempting to activate the UART1/serial1/ttyPS1 device using a custom device tree overlay. I’ve followed the following steps:

  1. Install the device tree compiler with apt install device-tree-compiler

  2. Create an overlay folder at /home/xilinx/pynq/overlays/uart_demo/

  3. Upload my uart_demo.bit and uart_demo.hwh files to said folder - note that said design isn’t particularly relevant to my issue as I can’t even get the Linux kernel to recognise UART1. The design does have the Zynq PS with UART1 enabled. Other than that it is as created by the Pynq-Z2 board files for Vivado.

  4. Write the following into /home/xilinx/enable_uart1.dts:

    /dts-v1/;
    /plugin/;
    
    / {	
    	fragment@0 {
    		target-path = "/aliases";
    		__overlay__ {
    			serial1 = "/amba/serial@e0001000";
    		};
    	};
    
    	fragment@1 {
    		target = <&uart1>;
    		__overlay__ {
    			status = "okay";
    		};
    	};
    };
    
  5. Run dtc -I dts -O dtb enable_uart.dts -o enable_uart.dtbo

  6. Run cp enable_uart.dtbo /home/xilinx/pynq/overlays/uart_demo/enable_uart.dtbo

  7. Run the following code in a Jupyter notebook:

    from pynq import Overlay
    ol = Overlay("uart_demo.bit", dtbo="enable_uart1.dtbo")
    
  8. Observe the following logs from dmesg:

    [36956.690682] fpga_manager fpga0: writing uart_demo.bit.bin to Xilinx Zynq FPGA Manager
    [36956.790444] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /aliases/serial1
    [36956.798598] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /amba/serial@e0001000/status
    [36956.808641] xuartps e0001000.serial: uart_add_one_port() failed; err=-22
    [36956.822036] xuartps: probe of e0001000.serial failed with error -22
    

I’m at a loss, as I’ve tried many things. Edit: things I’ve tried as I needed more than two links