How to setup GPIO Level interrupts correctly

If i setup GPIO level interrupt as follows,

ret = gpio_pin_interrupt_configure_dt(&spiInterrupt, GPIO_INT_TRIG_LOW |GPIO_INT_MODE_LEVEL);


My gpio interrupt callback keeps on getting executed. My ISR only releases a semaphore, the SPI read operation is in main thread.
Until i read, the peripheral will keep the GPIO pin active. If i setup the pin as follows


ret
= gpio_pin_interrupt_configure_dt(&spiInterrupt, GPIO_INT_TRIG_LOW);


then everything works correctly, I get only one interrupt call. But this call is wrong (or is it?) and if compiled with CONFIG_ASSERT
it will fail with assertion "Must either enable or disable interrupts"

Whats the right way to setup GPIO interrupts for my case where an interrupt should release a semaphore and the main thread can then
read from SPI.I cannot use edge triggers because of Errata 153.
Parents Reply Children
No Data
Related