GPIO interrupt is not being fired

Hi guys,
I have this block diagram -

Where they’re two GPIO IPs connected to a RTL IP. One takes the input from the RTL IP and the other gives a signal to the RTL IP.

To confirm, I am doing a Level-triggered interrupt in the interrupt controller -


And confirm this from /proc/interrupts (can see the fabric interrupt as a Level).

However the interrupt is never fired whenever I write to the axi_gpio_0 or when axi_gpio_0 receives a signal from the RTL IP. I say this because -

  • The fabric level interrupt in /proc/interrupts never goes up
  • The interrupt handler never exits the await statement. Code given below-
import asyncio
import random
import time
import itertools
from pynq.lib import AxiGPIO
from pynq import Overlay

ol = Overlay("design_1_wrapper.bit")
gpio_out = AxiGPIO(ol.ip_dict['axi_gpio_0'])
gpio_in = AxiGPIO(ol.ip_dict['axi_gpio_1'])
gpio_width = int(ol.ip_dict.get('axi_gpio_0').get('parameters').get('C_GPIO_WIDTH'))
async def launch_interrupts():
    global read_gpio
    global stop
    while True:
        x = gpio_in.ip2intc_irpt
        print(x.waiting)
        print(x.number)
        print(x.event)
        gpio_in.register_map.IP_IER[0] = 1
        gpio_in.register_map.IP_ISR[0] = 0
        print(gpio_in.register_map)
        # gets stuck in below statement here
        await gpio_in.ip2intc_irpt.wait()
        print(gpio_in.register_map)
        stop = time.timer_ns()
        read_gpio = gpio_in.channel1[0:gpio_width].read()
        gpio_in.register_map.IP_IER[1] = 0
my_event_loop = asyncio.get_event_loop()
wake_up_task = my_event_loop.create_task(launch_interrupts())
for iteration in range(0, 3):
    stream = 0x1e * iteration 
    print("Write iteration: " +str(iteration) + " with value: " + str(hex(stream)))
    start = time.time_ns()
    gpio_out.channel1[0:gpio_width].write(stream)
    await asyncio.sleep(2)
    print("Timer: " + str(stop - start))

Output:

Write iteration: 0 with value: 0x0
False
1
<asyncio.locks.Event object at 0xa99e3d48 [unset]>
RegisterMap {
  GPIO_DATA = Register(Channel_1_GPIO_DATA=0),
  GPIO_TRI = Register(Channel_1_GPIO_TRI=4294967295),
  GPIO2_DATA = Register(Channel_2_GPIO_DATA=0),
  GPIO2_TRI = Register(Channel_2_GPIO_TRI=4294967295),
  GIER = Register(Global_Interrupt_Enable=1),
  IP_ISR = Register(Channel_1_Interrupt_Status=0, Channel_2_Interrupt_Status=0),
  IP_IER = Register(Channel_1_Interrupt_Enable=1, Channel_2_Interrupt_Enable=0)
}
Timer: -1666654207061766407
Write iteration: 1 with value: 0x1e
Timer: -1666654209065806410
Write iteration: 2 with value: 0x3c
Timer: -1666654211069317287

Any ideas on why am I wrong here? I can provide any other info if needed. Thanks :slight_smile:

PYNQ version: latest, Board: PYNQ-Z2, Vivado version: 2022.2. Rename the files to design_1_wrapper.*
design_1.hwh (296.7 KB)
design_1.tcl (18.7 KB)
design_1_wrapper.bit (3.9 MB)