UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Visitor asuarez
Visitor
1,876 Views
Registered: ‎02-14-2018

Petalinux 2017.4 Zynq PL-PS Interrupt Question

Jump to solution

So I have two interrupts that are generated by the PL in my application see attached images below. They are connected to the xlconcat that connects to the IRQ_F2P port. I understand that I have to create a device driver to pick up the interrupt but not much past that. Does anyone have any information on how to proceed?

 

I'm particularly confused with finding out the irq number in linux (they appear as 61 & 62 in baremetal code) and how to include the interrupts in the device tree since they are not tied to any peripheral (ie. spi, gpio). 

 

 

Screenshot from 2018-02-26 14-51-43.png

 

 

Screenshot from 2018-02-26 14-51-25.png

0 Kudos
1 Solution

Accepted Solutions
Moderator
Moderator
2,594 Views
Registered: ‎09-12-2007

Re: Petalinux 2017.4 Zynq PL-PS Interrupt Question

Jump to solution

I have attached a simple doc that uses a UIO with interrupt support. I am generating the interrupt via a mailbox IP. However, it does explain the interrupt pins that may be of help.

6 Replies
Observer gerardmssm
Observer
1,851 Views
Registered: ‎12-15-2017

Re: Petalinux 2017.4 Zynq PL-PS Interrupt Question

Jump to solution

You have to look for your interruptions in the xparameters.h file when you locate your interrupt number substract 32 and that's the number you should include in your device tree. 

 

I think this tutorial series would be useful

 

http://xillybus.com/tutorials/device-tree-zynq-1

 

Regards

1,830 Views
Registered: ‎04-20-2017

Re: Petalinux 2017.4 Zynq PL-PS Interrupt Question

Jump to solution
Writing your own kernel space device driver can be overkill for many applications

I suggest you to have a look at the UIO driver. With that you can expose the memory mapped addresses AND irq of your device into userspace and use it in blocking and non blocking way.

You have to build it into petalinux with petalinux-config - c kernel, drivers, UiO, generic uio with irq

Then edit the device tree to mark you ip core as xompatible to the uio driver (which everything woth irq and memory mapped addresses is)

Usually that way you dont need to worry about irq number, vivado is doing that for you. They are in incrementing order as connected to the concat

To see if it works in linux
Cat /proc/interrupts
Your device should be listed there abd zhe irqs counted

Please accept as solution if it is fir you
Highlighted
Visitor asuarez
Visitor
1,814 Views
Registered: ‎02-14-2018

Re: Petalinux 2017.4 Zynq PL-PS Interrupt Question

Jump to solution

@gerardmssm thanks for the link, I specifically like the line in Part 3 "Never write a device driver for Linux.

Rather, find a well-maintained driver for some other hardware with similar functionality, and hack it". Some real wisdom there.  

 

juergen.kratochwill@grapho-metronic.com you made a very good point I rathered not write a driver just for a few interrupts. I am aware of the UIO driver and have included it in my kernel I'm just not sure what you mean by:

 

"edit the device tree to mark you ip core as compatible to the uio driver"

 

Where do I add compatible = "generic-uio"; ? All the PL stuff is on the amba_pl bus in pl.dtsi but I don't see where I could add it? Do you have an example or maybe a rough idea of what it should look like?

 

 

0 Kudos
Observer gerardmssm
Observer
1,800 Views
Registered: ‎12-15-2017

Re: Petalinux 2017.4 Zynq PL-PS Interrupt Question

Jump to solution

It's bettter to instatiate your device in system-top because pl.dtsi is going to change if you make changes to your hw. Regarding your second question a typical device looks like this: 

axi_vdma_0: dma@40000000 {
#dma-cells = <1>;
compatible = "xlnx,axi-vdma-1.00.a";
interrupt-parent = <&intc>;
interrupts = <0 32 4>;
reg = <0x40000000 0x10000>;
xlnx,flush-fsync = <0x1>;
}

 

You need to change the line with the compatible key, if your device doesn't have it you can add it to the end, the order usually doesn't matter. 

1,775 Views
Registered: ‎04-20-2017

Re: Petalinux 2017.4 Zynq PL-PS Interrupt Question

Jump to solution

ideally you add it in the /metalayer folder system-user.dtsi

 

for examle...that way you can override existing nodes or add new ones...

 

in this case ind the spi0 node, the status entry for example gets overwritten, the spidevice newly added.

 

in your case for example &axi-gpio{... compatibile="UIO...}

you can find out the node names by looking into pl.dtsi file also in the project dir

 

/include/ "system-conf.dtsi"
/ {
};

&spi0{
#address-cells=<1>;
#size-cells=<0>;
status = "okay";


axispidevice: spidev@0 {
              compatible = "spidev";
              reg = <0>;  
              spi-max-frequency = <3125000>;
	      
            };


};

please accept as solution

 

 

 

Moderator
Moderator
2,595 Views
Registered: ‎09-12-2007

Re: Petalinux 2017.4 Zynq PL-PS Interrupt Question

Jump to solution

I have attached a simple doc that uses a UIO with interrupt support. I am generating the interrupt via a mailbox IP. However, it does explain the interrupt pins that may be of help.