Irq from GPIO not working

Hi,
I try to generate an Interrupt on a falling edge detected by a GPIO. I followed the IrqDemo, but my implementation fail. Cant’t find a reason…

As I have more than one irq I created a type which holds all data related to one Interrupt:

typedef struct
{
	HANDLE		hEvent;
	DWORD		dwSysIntrNumber;
}GPIO_IRQ_t;

And a Little helper:

static void SetupGpioInterrupt(HANDLE hIntr, HANDLE hGpio, uIo pin, GPIO_IRQ_t* irq)
{
    DWORD irqNum = 0;
    BOOL result =false;
    
    //pin = Gpio_NormalizeIo(hGpio, pin);
    Gpio_GetConfigInt(hGpio, pin, L"irq", &irqNum);
    irq->hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
    irq->dwSysIntrNumber = Int_RequestSysInterrupt(hIntr, irq->dwSysIntrNumber);
    result = Int_InterruptInitialize(hIntr, irq->dwSysIntrNumber, irq->hEvent, NULL, 0);
    Int_InterruptDone(hIntr, irq->dwSysIntrNumber);
}

y pin:

#define TRIGGER_TRANSFER_PIN_NUM 101		// ISIS X16.16

To make typing easier I created a Symbol:

#define CFG_AS_IRQ_UP47k_SMTT_FALL	L"altfn=-1, dir=in,  pull=up47k, inmode=schmitt, irqtrig=falling"

Now I tried to Setup a pin:

uIo				ioTrgTransfSig		= COLIBRI_PIN( TRIGGER_TRANSFER_PIN_NUM );
GPIO_IRQ_t		g_TriggerTransferIRQ;

success = Gpio_SetConfigString(hGpio, ioLastXFerSig,	NULL, CFG_AS_INPUT_UP47k_SMTT,		StoreVolatile);
hIntr = Int_Init();
SetupGpioInterrupt(hIntr, hGpio, ioTrgTransfSig, &g_TriggerTransferIRQ);

But no Interrupt, and yes, there is an falling edge, my scope told me.

I tried it with and without the pin = Gpio_NormalizeIo(hGpio, pin); Statement.

Thanks for helping.

With best regards

Gerhard

Dear @Gerhard

The function Int_RequestSysInterrupt() translates a hardware IRQ number into a locigal SysIntr interrupt number. The respective line of code in your example should be:

   irq->dwSysIntrNumber = Int_RequestSysInterrupt(hIntr, irqNum);
// it was: 
// irq->dwSysIntrNumber = Int_RequestSysInterrupt(hIntr, irq->dwSysIntrNumber);

Regards, Andy

ohhhh, what a typo.

Sorry.

So, seems that the interrupt service routine (ISR) runs now (once). Interrupt latency is about 30µs !!!
Is this possible? Have you any data (specs, measurements, …) about that?
My former SoM needs 200µs.

I have to stop investigation for some days, other high priority task …, will do more measurements next week.

With best regards

Gerhard

Dear @Gerhard

Interrupt latencies of 30µs (worst-case, not average) is not surprising. There are operations that cannot be interrupted (for example cache flushing) which can block the system for quite some time in special situations.

Regards, Andy