External Interrupt on INT1

Hi Everyone,

I am working on Q2686RD on a custom platform with following configuration

“DWL”,“V10c05”,"",“Sierra Wireless”,62640,“051513 10:45”,“a0836b50”,“00010000”
“FW”,“FW_752_34_3.Q2687RDG”,“R7.52.0.201306260837.Q2686RD”,“Sierra Wireless”,673436,“062613 08:37”,“89796368”,“001d0000”
“MODEM”,“1.3.36”,“201306260837.Q2686RD”,“Sierra Wireless”,1713240,“062613 08:37”,“85a2fb97”,“00020000”
“OAT”,“1.0.0.20140108105505”,“IO_Expander_I2C”,“TAGV e solutions”,77512,“010814 11:04”,“71d1227f”,“002a0000”
-“Developer Studio”,“2.3.2.201310241753”
-“Open AT Framework package”,“2.51.0.201206190958”
-“Open AT OS Package”,“6.51.0.201206010944”
-“Firmware Package”,“7.51.0.201205311751”
“ROM”,“800000”
“RAM”,“200000”
“DWLNAME”,“Q2686RD”

i am having a problem working with external interrupt. Here is the code i have been working with. i am able to register the external interrupt(INT1) and the irq, but unable to produce the event.

Please do provide comments…

// ExtInt interruption handler
bool KeyPad_irqHandler ( adl_irqID_e Source,
adl_irqNotificationLevel_e NotificationLevel,
adl_irqEventData_t * Data )
{
s32 Return;

TRACE( ( STORAGE_I2C_TRACE_LEVEL, "KeyPad_irqHandler " ) );

adl_extintRead ( ExtIntHandle, &Status );
TRACE( ( IRQ_MEASURE_TRACE_LEVEL, "External Interrupt pin status: %d ", Status) );
// Input status can also be obtained from the auto read option.
 AutoReadStatus = ( adl_extintInfo_t * ) Data->SourceData;
 TRACE( ( IRQ_MEASURE_TRACE_LEVEL, "PCA Int Status %d ",AutoReadStatus) );

}

void KeyPad_Extirq ( void )
{

   /* Get ExtInt Capabilities */
adl_extintGetCapabilities ( &ExtIntCapabilities );

TRACE( ( IRQ_MEASURE_TRACE_LEVEL, "DebounceMode : available %d "
          "DebounceNbStep %d", ExtIntCapabilities.DebounceMode ,
          ExtIntCapabilities.DebounceNbStep ) );

// Test if the WCPU have Ext Int pin
if ( ExtIntCapabilities.NbExternalInterrupt >= 1 )
{

// ExtInt configuration: Falling edge detection without filter
     extintConfig.Sensitivity = ADL_EXTINT_SENSITIVITY_FALLING_EDGE;

    /* Set ExtInt Filter parameters */
    extintConfig.Filter = ADL_EXTINT_FILTER_BYPASS_MODE;
    extintConfig.FilterDuration = ZERO;
    TRACE( ( IRQ_MEASURE_TRACE_LEVEL, "extintConfig.Filter %d ", extintConfig.Filter) );

	IrqHandle = adl_irqSubscribe ( KeyPad_irqHandler, ADL_IRQ_NOTIFY_LOW_LEVEL, ADL_IRQ_PRIORITY_HIGH_LEVEL,ADL_IRQ_OPTION_AUTO_READ );
            TRACE( ( IRQ_MEASURE_TRACE_LEVEL, "IRQ Subscribe Handle:  %d ",IrqHandle) );
	TRACE( ( IRQ_MEASURE_TRACE_LEVEL, "External Interrupts : available %d ", ExtIntCapabilities.NbExternalInterrupt) );

   // Subscribes to the IRQ service
	ExtIntHandle = adl_extintSubscribe ( ADL_EXTINT_PIN1 , IrqHandle, 0, &extintConfig );

	if(ExtIntHandle >= OK)
	{
		adl_extintGetConfig(ExtIntHandle, &extintConfig);
		TRACE( ( IRQ_MEASURE_TRACE_LEVEL, "External Interrupts sensitivity %d ,filter  %d",
				extintConfig.Sensitivity,extintConfig.Filter) );

		adl_extintRead ( ExtIntHandle, &Status );
		TRACE( ( IRQ_MEASURE_TRACE_LEVEL, "External Interrupt pin status: %d ", Status) );
	}
}

}

Hiya,

A couple of things:

  1. Can you please edit your post to use the CODE tags around your source code - this will format the code nicely so that we can all read it.
  2. You can run into trouble having too many TRACE statements in your interrupt handlers … so it’s a good idea to minimize the number of TRACEs in the handler.
  3. Interrupt handler TRACEs come out on different levels to the standard TRACEs. You will have to enable the HLH (and possibly LLH) trace flows in the Dev Studio Trace manager.
  4. Have you set up the appropriate Stack values for the interrupt handlers? Open your ‘generated.c’ file, and in the wizard there are a couple of entries for ‘Interrupt Context’ - High Level interrupt stack size and Low Level interrupt stack size. You’ll probably need at least 1k (1024 bytes) and maybe more for each of your interrupt stacks.
  5. Finally, have you connected your interrupt input to the correct pin on the Q2686RD? Interrupt 1 is NOT pin 1 (or even GPIO1)…

Hope this helps you get started debugging.

ciao, Dave

Hi David,

I got external interrupt event. Here is the trace log

2014/01/09;11:17:57:993;000;LLH;0;[Enabled Levels] 1 2 3 4
2014/01/09;11:09:36:965;001;LLH;2;KeyPad_irqHandler
2014/01/09;11:09:36:965;002;LLH;1;External Interrupt pin status: 0

Here is the code that mislead me. Following code has been provided along with dev studio example, and this code is present in appli.c not in generated.c as you suggested.

After making changes in the generated.c and enabling the HLH amd LLH, i am able to produce external interrupt event.

#ifndef GNU_GCC
//
/* Mandatory variables /
/
---------------------------------------------------------------------------/
/
wm_apmIRQLowLevelStackSize /
/
wm_apmIRQHighLevelStackSize /
/
---------------------------------------------------------------------------*/
/
/

//
/* Macro : DECLARE_CALL_STACK /
/
---------------------------------------------------------------------------/
/
Object : The GCC compiler and GNU Newlib (standard C library) /
/
implementation require more stack size than ARM compilers. If /
/
the GCC compiler is used, the Open AT® application has to be /
/
declared with greater stack sizes. /
/
/
/
---------------------------------------------------------------------------/
/
Variable Name |IN |OUT|GLB| Utilization /
/
--------------------±–±--±–±-----------------------------------------/
/
X | X | | | required stack size /
/
--------------------±–±--±–±-----------------------------------------*/
/
/
#define DECLARE_CALL_STACK(X) (X)
//
/* Macro : DECLARE_LOWIRQ_STACK /
/
---------------------------------------------------------------------------/
/
Object : The GCC compiler and GNU Newlib (standard C library) /
/
implementation require more stack size than ARM compilers. If /
/
the GCC compiler is used, the Open AT® application has to be /
/
declared with greater stack sizes. /
/
/
/
---------------------------------------------------------------------------/
/
Variable Name |IN |OUT|GLB| Utilization /
/
--------------------±–±--±–±-----------------------------------------/
/
X | X | | | required stack size for IRQ low level /
/
--------------------±–±--±–±-----------------------------------------*/
/
/
#define DECLARE_LOWIRQ_STACK(X) const u32 wm_apmIRQLowLevelStackSize = X
//
/* Macro : DECLARE_HIGHIRQ_STACK /
/
---------------------------------------------------------------------------/
/
Object : The GCC compiler and GNU Newlib (standard C library) /
/
implementation require more stack size than ARM compilers. If /
/
the GCC compiler is used, the Open AT® application has to be /
/
declared with greater stack sizes. /
/
/
/
---------------------------------------------------------------------------/
/
Variable Name |IN |OUT|GLB| Utilization /
/
--------------------±–±--±–±-----------------------------------------/
/
X | X | | | required stack size for IRQ high level /
/
--------------------±–±--±–±-----------------------------------------*/
/
/
#define DECLARE_HIGHIRQ_STACK(X) const u32 wm_apmIRQHighLevelStackSize = X
#else /* #ifndef GNU_GCC /
#define DECLARE_CALL_STACK(X) (X
3)
#define DECLARE_LOWIRQ_STACK(X) const u32 wm_apmIRQLowLevelStackSize = X3
#define DECLARE_HIGHIRQ_STACK(X) const u32 wm_apmIRQHighLevelStackSize = X
3
#endif /* #ifndef GNU_GCC /
/
Call stack size declaration */
DECLARE_LOWIRQ_STACK ( 1024 );
DECLARE_HIGHIRQ_STACK ( 1024 );
// Application tasks prototypes
extern void main_task ( void );

// Application tasks declaration table
const adl_InitTasks_t adl_InitTasks [] =
{
{ main_task, DECLARE_CALL_STACK ( 1024 ), “main”, 1 },
{ 0, 0, 0, 0 }
};

Secondly, These are the only options provided in the OpenAT to specify the external interrupt pins.

/**
@brief Former constant used to identify the External Interrupt pin 0

@deprecated Kept for application code ascendant compatibility
*/
#define ADL_EXTINT_PIN0 0

/**
@brief Former constant used to identify the External Interrupt pin 1

@deprecated Kept for application code ascendant compatibility
*/
#define ADL_EXTINT_PIN1 1

/**
@brief Former constant used to identify the maximum known External Interrupt pin. This is not the real maximum value.

@deprecated Kept for application code ascendant compatibility
*/
#define ADL_EXTINT_PIN_LAST 2

Hiya,

Good to hear that you’ve got it going.

Unfortunately, sometimes the Sierra Wireless doco lags a long way behind the current firmware.

ciao, Dave