DSPRelated.com
Forums

Configuring an ISR for GPIO2 or GPIO7 interrupts on DSP side (OMAP5912)

Started by r_hmoreno March 6, 2009
Hi,

I use Code Composer Studio 2.21, with CSL 3.0 to develop code for OMAP5912 platform.

I'm trying to configure (via DSP side) GPIO7 and GPIO2 as inputs and configure the generation of an interrupt as these lines are set to '1' (rising edge).

The point is that I'm trying to associate an ISR to be called when the interrupt occurs. It has not been easy, once these GPIOs are not prepared to set level 1 DSP interrupts, and I can't set the ISR directly from the HWI vector of '.cdb' file.

What I have tried to do is to associate a level 2 DSP interrupt to the GPIO and both, use 'CSL_intcHookIsr' function to hook up the ISR function to the IRQ2_GPIO2 event or the function 'CSL_intcPlugEventHandler', with no success. I am doing something wrong? I have tried the following code:
void configureGpiosIntBridges()
{
Uint16 ready;
CSL_Status status;
CSL_IntcObj intcObj;
CSL_IntcHandle hIntc;
CSL_IntcEventHandlerRecord evtHandlerRecord;
CSL_BitMask16 ctrlMask;

// Sets direction of GPIO2 to 'input'
GPIO_DIRECTION = GPIO_DIRECTION | 0x0004;

// Enables interrupt for GPIO2
GPIO_IRQENABLE2 = GPIO_IRQENABLE2 | 0x0004;

// Sets interrupt trigger for 'rising edge' (GPIO2 --> Bits 3/2)
GPIO_EDGE_CTRL2 = GPIO_EDGE_CTRL2 | 0x0008;

DSP_L2_CONTROL_REG = 0x0001;

// Higher priority interrupt, rising edge sensitive and IRQ generation
DSP_L2_ILR12 = 0x0000;

// Inits CSL interrupt module
CSL_intcInit();

// Opens CSL_intc module
hIntc = CSL_intcOpen(&intcObj, CSL_INTC_EVENTID_IRQ2GPIO2, NULL, NULL, &status);

// Inits dispatcher module
CSL_intcDispatcherInit();

evtHandlerRecord.handler = isr_gpio2;

evtHandlerRecord.arg = (void *)hIntc;

CSL_intcPlugEventHandler(hIntc, &evtHandlerRecord);

//CSL_intcHookIsr(CSL_INTC_EVENTID_IRQ2GPIO2, (Uint32) isr_gpio2);
}

interrupt void isr_gpio2()
{
// Acks interrupt
GPIO_IRQENABLE2 = 0x0004;

// Calls RX bridge
bridgeRX();
}
The procedure I'm taking to debug the code is to let it run free (with XDS510 connected) and setting a breakpoint on the first line of 'isr) gpio2' function (ISR function). After that, I set a high level on GPIO2 and check if the execution has stopped on the breakpoint.

Please, I need some clarification regarding this issue, because I have been over this problem for a couple of days.

Thanks a lot! Rafael.
Hi,

I want to update this thread with some modifications I have implemented in my code. Currently a part of the problem was solved, but I still can't get access to my ISR by the 'rising edge' of GPIO2, in this case.

I have validated the chain from level 2 to level 1 interrupt on DSP side. My ISR is now called from HWI3 on cdb (input from level 2 interrupt). The level 2 interrupt controller and GPIO2 are set as follows:

// Sets direction of GPIO2 to 'input'
GPIO_DIRECTION = GPIO_DIRECTION | 0x0004;

// Enables interrupt for GPIO2
GPIO_IRQENABLE2 = GPIO_IRQENABLE2 | 0x0004;

// Sets interrupt trigger for 'rising edge' (GPIO2 --> Bits 3/2)
GPIO_EDGE_CTRL1 = GPIO_EDGE_CTRL1 | 0x0008;

// Higher priority interrupt, rising edge sensitive and IRQ generation
DSP_L2_ILR12 = 0x0001;

// Clears FIQ 12
DSP_L2_ITR = DSP_L2_ITR & 0xEFFF;

// Mask bit 12 (interrupt 12)
DSP_L2_MIR = DSP_L2_MIR & 0xEFFF;

// Resets FIQ output and prepares for a new FIQ generation
DSP_L2_CONTROL_REG = 0x0001;

It is possible to see that GPIO2 is configured to generate interrupt on IRQ2 (DSP), on the rising edge.

This interrupt was supposed to be routed to IRQ12 (level 2), according to SPRU757B (page 13), but it seems it is not. If I set a software interrupt (DSP_SISR register) on IRQ line 12, finally I could be routed to my ISR.

It seems that GPIO2 is not generating interrupt on line 12 as presented in SPRU757B. I have tried to monitore all the 16 level 2 IRQ lines, but no interrupt was generated when toggling GPIO2 level to '1'.

The point now is to know how to generate the level 2 interrupt by the GPIO, or how to tie its interrupt to a level 2 IRQ line. The rest of it seems to be ok now.

Any help would be great!!

Thanks a lot.

Rafael.

--- In c..., "r_hmoreno" wrote:
>
> Hi,
>
> I use Code Composer Studio 2.21, with CSL 3.0 to develop code for OMAP5912 platform.
>
> I'm trying to configure (via DSP side) GPIO7 and GPIO2 as inputs and configure the generation of an interrupt as these lines are set to '1' (rising edge).
>
> The point is that I'm trying to associate an ISR to be called when the interrupt occurs. It has not been easy, once these GPIOs are not prepared to set level 1 DSP interrupts, and I can't set the ISR directly from the HWI vector of '.cdb' file.
>
> What I have tried to do is to associate a level 2 DSP interrupt to the GPIO and both, use 'CSL_intcHookIsr' function to hook up the ISR function to the IRQ2_GPIO2 event or the function 'CSL_intcPlugEventHandler', with no success. I am doing something wrong? I have tried the following code:
> void configureGpiosIntBridges()
> {
> Uint16 ready;
> CSL_Status status;
> CSL_IntcObj intcObj;
> CSL_IntcHandle hIntc;
> CSL_IntcEventHandlerRecord evtHandlerRecord;
> CSL_BitMask16 ctrlMask;
>
> // Sets direction of GPIO2 to 'input'
> GPIO_DIRECTION = GPIO_DIRECTION | 0x0004;
>
> // Enables interrupt for GPIO2
> GPIO_IRQENABLE2 = GPIO_IRQENABLE2 | 0x0004;
>
> // Sets interrupt trigger for 'rising edge' (GPIO2 --> Bits 3/2)
> GPIO_EDGE_CTRL2 = GPIO_EDGE_CTRL2 | 0x0008;
>
> DSP_L2_CONTROL_REG = 0x0001;
>
> // Higher priority interrupt, rising edge sensitive and IRQ generation
> DSP_L2_ILR12 = 0x0000;
>
> // Inits CSL interrupt module
> CSL_intcInit();
>
> // Opens CSL_intc module
> hIntc = CSL_intcOpen(&intcObj, CSL_INTC_EVENTID_IRQ2GPIO2, NULL, NULL, &status);
>
> // Inits dispatcher module
> CSL_intcDispatcherInit();
>
> evtHandlerRecord.handler = isr_gpio2;
>
> evtHandlerRecord.arg = (void *)hIntc;
>
> CSL_intcPlugEventHandler(hIntc, &evtHandlerRecord);
>
> //CSL_intcHookIsr(CSL_INTC_EVENTID_IRQ2GPIO2, (Uint32) isr_gpio2);
> }
>
> interrupt void isr_gpio2()
> {
> // Acks interrupt
> GPIO_IRQENABLE2 = 0x0004;
>
> // Calls RX bridge
> bridgeRX();
> }
> The procedure I'm taking to debug the code is to let it run free (with XDS510 connected) and setting a breakpoint on the first line of 'isr) gpio2' function (ISR function). After that, I set a high level on GPIO2 and check if the execution has stopped on the breakpoint.
>
> Please, I need some clarification regarding this issue, because I have been over this problem for a couple of days.
>
> Thanks a lot! Rafael.
>