Pynq use ps spi

Hi
I’m using Pynq v2.6 on a custom ultrascale development board.
I have a board overlay which I download succesfully (I can see my FPGA IP blocks) yet was wondering:
I also made adaptions to the ps: I enabled the SPI to be routed via EMIO. (not axi spi).
I do not see the spi appearing in /dev/ and using spidev to tells me there’s no spi device.
Before and after downloading the bitstream, the loaded device tree entrie looks the same (and especially the spi status “disabled” gives me the feeling nothing has changed)

spi@ff040000 {
                        power-domains = <0xc 0x23>;
                        #address-cells = <0x1>;
                        clock-names = "ref_clk", "pclk";
                        interrupts = <0x0 0x13 0x4>;
                        clocks = <0x3 0x3a 0x3 0x1f>;
                        #size-cells = <0x0>;
                        interrupt-parent = <0x4>;
                        compatible = "cdns,spi-r1p6";
                        status = "disabled";
                        reg = <0x0 0xff040000 0x0 0x1000>;
                        phandle = <0x63>;
                };
  1. When downloading a new bitstream, is the zynqmp also altered then?
  2. When downloading a new bitstream, is the device tree adapted? Can we dynamically alter the “compatible” entry of the device tree for other device drivers?

Or do I need to enable the SPI in the design, adapt the kernel (enabling the device drivers and altering the device tree upfront) and make a new pynq OS?

Sincerely
Wouter

1 Like

The only changes that PYNQ makes to the PS when downloading a new bitstream is to the clocks and the widths of the AXI interfaces. The device-tree can be dynamically updated using device-tree overlays however not all Linux drivers work correctly when loaded this way - I don’t know about the SPI driver specifically. If you want to try this you can use the dtbo keyword argument when creating the overlay to pass in the device-tree to apply. Section 2.1 of the RPI device-tree documentation has a good overview of overlays.

The easiest way would be to enable the SPI device in the hardware project you are using for your Petalinux BSP/project which avoids any dynamic loading of drivers at runtime.

Peter

1 Like

I am new to the PYNQ system, and I got the same problem with PS SPIs. Is there any example code using PS SPIs on the PYNQ-Z1 board? The trace buffer_spi.ipynb file, which is mentioned in Python productivity for Zynq (Pynq) documents, https://readthedocs.org/projects/pynq/downloads/pdf/v1.4/, is invalid.