# Interrupts not registering correctly

**URL:** <https://discuss.pynq.io/t/interrupts-not-registering-correctly/2119>\
**Category:** Support\
**Created:** [December 9, 2020, 2:28pm UTC](https://discuss.pynq.io/t/interrupts-not-registering-correctly/2119 "2020-12-09T14:28:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![abdel3740](https://avatars.discourse-cdn.com/v4/letter/a/a698b9/32.png) [@abdel3740](https://discuss.pynq.io/u/abdel3740)\
**Post date:** [December 9, 2020, 2:28pm UTC](https://discuss.pynq.io/t/interrupts-not-registering-correctly/2119/1 "2020-12-09T14:28:14Z")

</div>

I seem to have a problem with using Interrupts correctly.  
I want to use a dma for data transfer and write to several buffers.  
Once a buffer is written, I generate an Interrupt so that I can save the data from the buffer before it is rewritten with new data.  
As already mentioned in the forum I connected the **level-type** interrupts to the zynq via an interrupt controller

 ![image](https://us1.discourse-cdn.com/flex019/uploads/pynq1/original/2X/7/701f6e04fa1092aa5c9792cd55d62ef0bc70a986.png)  
And if I then load the overlay and start a transfer with 3MB size per Buffer and 2 Buffers and want my 12 MB of data, then on the first run I get 4 interrupts in the fabric interrupt in /proc/interrupts  
However, if I restart the same method I get only 3 interrupts  
And sometimes if I reload the overlay with let’s say 8 buffers instead of 2 the kernel/pynq dies and I have to do a system reset.

Also, my async functions still trigger on my defined interrupts but somehow get not shown in the fabric interrupt and I lose data.

Does someone have an idea where the problem could lie? Has someone experienced something similar? Do I have to take care of something special when defining interrupt signals?

Any help would be appreciated 🙂

This is my async code:

```
async def wait_for_interrupt(self,interrupt):
    try:
        f = open(self.filename+"buffer"+str(interrupt),'wb')
        for i in range(2):
            await self.interrupts[interrupt].wait()
            print("buffer",interrupt,"processed")
            with np.printoptions(threshold=np.inf): 
                        f.write(self.buffers[interrupt])
    finally:
        print("buffer",interrupt,"closed")
        f.close()
        return
async def async_transfer(self):
    await asyncio.gather(*(self.wait_for_interrupt(i) for i in range(self.buffercount)))
    return

```

---

<div class="post-metadata">

**Author:** ![abdel3740](https://avatars.discourse-cdn.com/v4/letter/a/a698b9/32.png) [@abdel3740](https://discuss.pynq.io/u/abdel3740)\
**Post date:** [December 10, 2020, 1:43pm UTC](https://discuss.pynq.io/t/interrupts-not-registering-correctly/2119/2 "2020-12-10T13:43:10Z")

</div>

I now noticed that the IRQ signal from the interrupt controller ist high for a very long time. Is this supposed to be the behaviour of IRQ? I thought it would deassert after an interrupt got awaited. If someone could shed some light on the issue that would be great! 🙂

Ok it seems that the interrupts should be working correctly. I still don’t know why I get less interrupts when restarting a data transfer. Will post if I find something.
