PYNQ 2.7 - USB host does not work

Hello

I compiled the Pynq 2.7 for Arty Z7-10 (zynq 7010) and i noticed that USB host never works.
It does not recognize any device, like usb flash drive, FTDI usb-serial converter nor USB wifi dongle.
Compilation works without problem, and in Vivado project USB host is correctly enabled.

Can you please help me how to proceed in debugging this issue?

Basically “LSUSB” command returns nothing.

Using device-tree-compiler I checked complete device tree in filesystem in /sys/firmware/devicetree/base and I see that USB0 is also enabled in device tree, but it still does not work:
(I deleted non relevant devices due to forum’s post character number limit, but full output is in the attachment)
device-tree.txt (56.6 KB)

/ {
        compatible = "xlnx,zynq-7000";
        #address-cells = <0x01>;
        #size-cells = <0x01>;

        amba {
                compatible = "simple-bus";
                ranges;
                interrupt-parent = <0x04>;
                #address-cells = <0x01>;
                #size-cells = <0x01>;
                phandle = <0x14>;
                u-boot,dm-pre-reloc;

                dmac@f8003000 {
                        #dma-cells = <0x01>;
                        compatible = "arm,pl330\0arm,primecell";
                        clocks = <0x01 0x1b>;
                        clock-names = "apb_pclk";
                        #dma-requests = <0x04>;
                        interrupt-parent = <0x04>;
                        interrupts = <0x00 0x0d 0x04 0x00 0x0e 0x04 0x00 0x0f 0x                                                                                                                                                                             04 0x00 0x10 0x04 0x00 0x11 0x04 0x00 0x28 0x04 0x00 0x29 0x04 0x00 0x2a 0x04 0x                                                                                                                                                                             00 0x2b 0x04>;
                        phandle = <0x2c>;
                        reg = <0xf8003000 0x1000>;
                        #dma-channels = <0x08>;
                        interrupt-names = "abort\0dma0\0dma1\0dma2\0dma3\0dma4\0                                                                                                                                                                             dma5\0dma6\0dma7";
                };

                gpio@e000a000 {
                        compatible = "xlnx,zynq-gpio-1.0";
                        clocks = <0x01 0x2a>;
                        gpio-mask-low = <0x5600>;
                        gpio-controller;
                        gpio-mask-high = <0x00>;
                        #interrupt-cells = <0x02>;
                        interrupt-parent = <0x04>;
                        interrupts = <0x00 0x14 0x04>;
                        phandle = <0x08>;
                        reg = <0xe000a000 0x1000>;
                        #gpio-cells = <0x02>;
                        emio-gpio-width = <0x40>;
                        interrupt-controller;
                };

                ethernet@e000c000 {
                        compatible = "cdns,zynq-gem\0cdns,gem";
                        clocks = <0x01 0x1f 0x01 0x1f 0x01 0x0e>;
                        clock-names = "pclk\0hclk\0tx_clk";
                        status = "disabled";
                        #address-cells = <0x01>;
                        interrupts = <0x00 0x2d 0x04>;
                        #size-cells = <0x00>;
                        phandle = <0x27>;
                        reg = <0xe000c000 0x1000>;
                };

                usb@e0003000 {
                        compatible = "xlnx,zynq-usb-2.20a\0chipidea,usb2";
                        clocks = <0x01 0x1d>;
                        status = "disabled";
                        interrupt-parent = <0x04>;
                        interrupts = <0x00 0x2c 0x04>;
                        phandle = <0x33>;
                        reg = <0xe0003000 0x1000>;
                        phy_type = "ulpi";
                };

                memory-controller@f8006000 {
                        compatible = "xlnx,zynq-ddrc-a05";
                        phandle = <0x1b>;
                        reg = <0xf8006000 0x1000>;
                };

                timer@f8002000 {
                        compatible = "cdns,ttc";
                        clocks = <0x01 0x06>;
                        interrupt-parent = <0x04>;
                        interrupts = <0x00 0x25 0x04 0x00 0x26 0x04 0x00 0x27 0x                                                                                                                                                                             04>;
                        phandle = <0x30>;
                        reg = <0xf8002000 0x1000>;
                };

                ethernet@e000b000 {
                        xlnx,ptp-enet-clock = <0x6750918>;
                        compatible = "cdns,zynq-gem\0cdns,gem";
                        clocks = <0x01 0x1e 0x01 0x1e 0x01 0x0d>;
                        clock-names = "pclk\0hclk\0tx_clk";
                        status = "okay";
                        #address-cells = <0x01>;
                        interrupts = <0x00 0x16 0x04>;
                        #size-cells = <0x00>;
                        phandle = <0x26>;
                        reg = <0xe000b000 0x1000>;
                        phy-mode = "rgmii-id";
                        enet-reset = <0x08 0x09 0x00>;
                };

                usb@e0002000 {
                        compatible = "xlnx,zynq-usb-2.20a\0chipidea,usb2";
                        clocks = <0x01 0x1c>;
                        status = "okay";
                        interrupt-parent = <0x04>;
                        interrupts = <0x00 0x15 0x04>;
                        phandle = <0x32>;
                        reg = <0xe0002000 0x1000>;
                        usb-reset = <0x08 0x2e 0x00>;
                        phy_type = "ulpi";
                };

        fpga-full {
                compatible = "fpga-region";
                fpga-mgr = <0x03>;
                ranges;
                #address-cells = <0x01>;
                #size-cells = <0x01>;
                phandle = <0x13>;
        };

        __symbols__ {
                ptm0_out_port = "/amba/ptm@f889c000/out-ports/port/endpoint";
                intc = "/amba/interrupt-controller@f8f01000";
                ocmc = "/amba/ocmc@f800c000";
                nand0 = "/amba/memory-controller@e000e000/flash@e1000000";
                i2c1 = "/amba/i2c@e0005000";
                replicator_out_port1 = "/replicator/out-ports/port@1/endpoint";
                gpio0 = "/amba/gpio@e000a000";
                qspi = "/amba/spi@e000d000";
                spi0 = "/amba/spi@e0006000";
                slcr = "/amba/slcr@f8000000";
                usb1 = "/amba/usb@e0003000";
                regulator_vccpint = "/fixedregulator";
                amba = "/amba";
                ttc1 = "/amba/timer@f8002000";
                funnel0_in_port1 = "/amba/funnel@f8804000/in-ports/port@1/endpoi                                                                                                                                                                             nt";
                fpga_full = "/fpga-full";
                watchdog0 = "/amba/watchdog@f8005000";
                sdhci0 = "/amba/mmc@e0100000";
                adc = "/amba/adc@f8007100";
                ptm1_out_port = "/amba/ptm@f889d000/out-ports/port/endpoint";
                gem1 = "/amba/ethernet@e000c000";
                cpu1 = "/cpus/cpu@1";
                L2 = "/amba/cache-controller@f8f02000";
                pinctrl0 = "/amba/slcr@f8000000/pinctrl@700";
                can0 = "/amba/can@e0008000";
                etb_in_port = "/amba/etb@f8801000/in-ports/port/endpoint";
                clkc = "/amba/slcr@f8000000/clkc@100";
                uart0 = "/amba/serial@e0000000";
                flash0 = "/amba/spi@e000d000/flash@0";
                replicator_in_port0 = "/replicator/in-ports/port/endpoint";
                spi1 = "/amba/spi@e0007000";
                i2c0 = "/amba/i2c@e0004000";
                tpiu_in_port = "/amba/tpiu@f8803000/in-ports/port/endpoint";
                global_timer = "/amba/timer@f8f00200";
                replicator_out_port0 = "/replicator/out-ports/port@0/endpoint";
                funnel_out_port = "/amba/funnel@f8804000/out-ports/port/endpoint                                                                                                                                                                             ";
                smcc = "/amba/memory-controller@e000e000";
                funnel0_in_port2 = "/amba/funnel@f8804000/in-ports/port@2/endpoi                                                                                                                                                                             nt";
                usb0 = "/amba/usb@e0002000";
                ttc0 = "/amba/timer@f8001000";
                mc = "/amba/memory-controller@f8006000";
                sdhci1 = "/amba/mmc@e0101000";
                devcfg = "/amba/devcfg@f8007000";
                funnel0_in_port0 = "/amba/funnel@f8804000/in-ports/port@0/endpoi                                                                                                                                                                             nt";
                nor0 = "/amba/memory-controller@e000e000/flash@e2000000";
                scutimer = "/amba/timer@f8f00600";
                dmac_s = "/amba/dmac@f8003000";
                efuse = "/amba/efuse@f800d000";
                can1 = "/amba/can@e0009000";
                gem0 = "/amba/ethernet@e000b000";
                uart1 = "/amba/serial@e0001000";
                cpu0 = "/cpus/cpu@0";
                rstc = "/amba/slcr@f8000000/rstc@200";
        };

        pmu@f8891000 {
                compatible = "arm,cortex-a9-pmu";
                interrupt-parent = <0x04>;
                interrupts = <0x00 0x05 0x04 0x00 0x06 0x04>;
                reg = <0xf8891000 0x1000 0xf8893000 0x1000>;
        };

        aliases {
                spi0 = "/amba/spi@e000d000";
                ethernet0 = "/amba/ethernet@e000b000";
                serial0 = "/amba/serial@e0000000";
        };

        chosen {
                stdout-path = "serial0:115200n8";
                bootargs = "root=/dev/mmcblk0p2 rw earlyprintk rootfstype=ext4 r                                                                                                                                                                             ootwait devtmpfs.mount=1 uio_pdrv_genirq.of_id=\"generic-uio\" clk_ignore_unused                                                                                                                                                                             ";
                pynq_board = "ArtyZ7";
        };

        xlnk {
                compatible = "xlnx,xlnk-1.0";
                clocks = <0x01 0x0f 0x01 0x10 0x01 0x11 0x01 0x12>;
                clock-names = "xclk0\0xclk1\0xclk2\0xclk3";
        };

        memory {
                device_type = "memory";
                reg = <0x00 0x20000000>;
        };

        cpus {
                #address-cells = <0x01>;
                #size-cells = <0x00>;

                cpu@1 {
                        compatible = "arm,cortex-a9";
                        clocks = <0x01 0x03>;
                        device_type = "cpu";
                        phandle = <0x11>;
                        reg = <0x01>;
                };

                cpu@0 {
                        compatible = "arm,cortex-a9";
                        clocks = <0x01 0x03>;
                        device_type = "cpu";
                        cpu0-supply = <0x02>;
                        phandle = <0x0f>;
                        reg = <0x00>;
                        operating-points = <0x9eb10 0xf4240 0x4f588 0xf4240>;
                        clock-latency = <0x3e8>;
                };
        };

        replicator {
                compatible = "arm,coresight-static-replicator";
                clocks = <0x01 0x1b 0x01 0x2e 0x01 0x2f>;
                clock-names = "apb_pclk\0dbg_trc\0dbg_apb";

                in-ports {

                        port {

                                endpoint {
                                        remote-endpoint = <0x07>;
                                        phandle = <0x0c>;
                                };
                        };
                };

                out-ports {
                        #address-cells = <0x01>;
                        #size-cells = <0x00>;

                        port@1 {
                                reg = <0x01>;

                                endpoint {
                                        remote-endpoint = <0x06>;
                                        phandle = <0x0a>;
                                };
                        };

                        port@0 {
                                reg = <0x00>;

                                endpoint {
                                        remote-endpoint = <0x05>;
                                        phandle = <0x0b>;
                                };
                        };
                };
        };

        fixedregulator {
                compatible = "regulator-fixed";
                regulator-boot-on;
                phandle = <0x02>;
                regulator-min-microvolt = <0xf4240>;
                regulator-max-microvolt = <0xf4240>;
                regulator-always-on;
                regulator-name = "VCCPINT";
        };
};

I also think that dmesg recognizes something on startup but i am not sure.
I am attaching the dmesg output to this post.
dmesg.txt (15.1 KB)

Thank you for any help with this problem

1 Like

here is USB configuration from my .TCL file:

   CONFIG.PCW_USB0_BASEADDR {0xE0102000} \
   CONFIG.PCW_USB0_HIGHADDR {0xE0102fff} \
   CONFIG.PCW_USB0_PERIPHERAL_ENABLE {1} \
   CONFIG.PCW_USB0_PERIPHERAL_FREQMHZ {60} \
   CONFIG.PCW_USB0_RESET_ENABLE {1} \
   CONFIG.PCW_USB0_RESET_IO {MIO 46} \
   CONFIG.PCW_USB0_USB0_IO {MIO 28 .. 39} \
   CONFIG.PCW_USB1_BASEADDR {0xE0103000} \
   CONFIG.PCW_USB1_HIGHADDR {0xE0103fff} \
   CONFIG.PCW_USB1_PERIPHERAL_ENABLE {0} \
   CONFIG.PCW_USB1_PERIPHERAL_FREQMHZ {60} \
   CONFIG.PCW_USB1_RESET_ENABLE {0} \
   CONFIG.PCW_USB_RESET_ENABLE {1} \
   CONFIG.PCW_USB_RESET_POLARITY {Active Low} \
   CONFIG.PCW_USB_RESET_SELECT {Share reset pin} \

This looks correct i think.

1 Like

I will post a solution to this problem, perhaps somebody can save many hours of troubleshooting.

Cause:
USB host will not work if before compilation the you have not specified device tree patch in system-user.dtsi. This is not really explained at all in documents but you can check how to configure the patch in Pynq-Z1 for example. Without this patch device tree will not have necessary pyh endpoints.

Solution 1:
Add correct settings in : PYNQ/boards/board_name/petalinux_bsp/meta-user/recipes-bsp/device-tree/files/system-user.dtsi and recompile pynq project.

Solution 2:
You can find on net, how to patch and modify device tree using device-tree-compiler.
You need 2 files from the host machine used for compiling pynq project zImage, and image.its, and put it in boot partition of sd card. They are in sdbuild/boards i think. You must extract device tree blob, and decompile it into system.dts file for editing.

Patch decompiled device tree usb section :

usb@e0002000 {
    compatible = "xlnx,zynq-usb-2.20a\0chipidea,usb2";
    status = "okay";
    clocks = <0x01 0x1c>;
    interrupt-parent = <0x04>;
    interrupts = <0x00 0x15 0x04>;
    reg = <0xe0002000 0x1000>;
    phy_type = "ulpi";
    usb-reset = <0x08 0x2e 0x00>;
    usb-phy = <0x36>;  #add this line with handle number that is not already used, needed for next block
    phandle = <0x32>;
 };

and after chosen, aliases and memory blocks add the following :

phy0 {
    compatible = "ulpi-phy";
    #phy-cells = <0x0>;
    reg = <0xe0002000 0x1000>;
    view-port = <0x170>;
    drv-vbus;
    phandle = <0x36>;     #same as above block
    };

while editing dts, you can also add phy endpoint to ethernet as following:

ethernet@e000b000 {
        compatible = "cdns,zynq-gem\0cdns,gem";
        reg = <0xe000b000 0x1000>;
        status = "okay";
        interrupts = <0x00 0x16 0x04>;
        clocks = <0x01 0x1e 0x01 0x1e 0x01 0x0d>;
        clock-names = "pclk\0hclk\0tx_clk";
        #address-cells = <0x01>;
        #size-cells = <0x00>;
        enet-reset = <0x08 0x09 0x00>;
        phy-mode = "rgmii-id";
        xlnx,ptp-enet-clock = <0x6750918>;
        phy-handle = <0x37>;    #unique handle number needed
        phandle = <0x26>;

        ethernet-phy@1{
            reg = <0x1>;
            phandle = <0x37>;
        };
    };

after adding these end points, we must modifiy symbols list to add these 2:

usb_phy0 = "/phy0";
ethernet_phy = "/amba/ethernet@e000b000/ethernet-phy@1";

Afterwards, recompile the dts into device tree blob using

dtc -I dts -O dtb -o system.dtb system.dts

any reused handle numbers will be shown as errors here, compilation will fail, so you must fix it before proceeding.

and remake boot image using

mkimage -f image.its image.ub

reboot, and it should work.

1 Like