PYNQ: PYTHON PRODUCTIVITY FOR ZYNQ

pynq.Interrupt not working for separate applications/noteBooks

Hi,
I was working on an application where I need to interface two interrupts generating from separate chips,
After configured interrupts on the pl side with axi_int_controller to irq[0] i can see interrupts are incrementing in /proc/interrupts as uio device 0.
The Interrupts are working fine if i use the pynq.interrupts in the same notebook or we can say in the same application. If i create two different note books each for individual interrupts , things gone on halt and interrupts are not working. I put all the efforts suspecting that something was wrong with my asyncio event loop logic and wasted almost a week on it bit nothing improved so.
To narrow down the problem i created two gpio interrupts and check its behaviour and it came a different issue.
Notebook 1:


Notebook2:

everything goes on track interrupts are generating fine as soon as i call below on another notebook

gpint2 = pynq.Interrupt(“gpio_2_intr/Dout”)

interrupts are not serviced anymore. BTW booth noteboos works fine which so ever i start first so everything else is in connection.

Please advise anything i am doing wrong or there is some bug in Interrupt.py.
Thanks

I am still waiting for reply, let me even now if its not possible with pynq.interrupt ?

It’s not a thing we’ve tested. At a guess there is a race condition somewhere in how the interrupts get serviced that is not easily fixed. There isn’t a way for the interrupt controller driver in each process to know someone else is waiting and not clear the interrupts. Depending on how time-critical your interrupt handling is I would try to move it all into a single process and then use sockets or similar to signal to the others that an interrupt has occurred. Sorry there’s not a more off-the-shelf solution available.

Peter

Hi Peter,
Okay thanks for the reply again, In this scenario. i am thinking on another approach like
if i dont use your logic as to connect axi_intr_controller in the PL instead, connect the interrupts directly to IRQ[0:1]. then Add both the interrupts in device tree so that they are enumerated in /dev/uio0 and /dev/uio1, and use your recommendation in another post as

controller = UioController("/dev/uio0")
event = asyncio.Event()
async def interrupt_test():
while True:
event.clear()
controller.add_event(event, 0) # Number is a dummy variable
await event
print(“Interrupt Triggered”)

loop = asyncio.get_event_loop()
loop.run_until_complete(interrupt_test())

and in another applications as
controller1 = UioController("/dev/uio1")

whill it work in seperate nootebooks?

That should work. The UIO controllers won’t interact with each other.

Peter