AnsweredAssumed Answered

LPC55S69: how-to detect both edges for more than one GPIO pin by GINT0/1

Question asked by Eugene Hiihtaja on Nov 14, 2019
Latest reply on Dec 6, 2019 by Eugene Hiihtaja

Hello !

 

 

I need to have ISR by multiple GPIO lines in ACTIVE, SLEEP and POWER DOWN modes.

I would like to detect both edges and try to utilize both GINTx and include pin twice and configure GINT0 for detect rising edge and GINT1 for falling edge ( or vise versa).

If only one pin added to both GINTx, both edges are detected. If more than 1, it start to detect falling edge only.

Weird. May be it depends from some configuration what should be used when power management API is called ?

I have checked all possible combinations and haven't find working combination how-to detect both edges for set of pins from both GPIO ports.

 

Is any limitations exists ? There are not visible in UM.

I have attached exact modified gint example.

 

Essential part :

 

/* Select one input, active low for GINT0 */
#define DEMO_GINT0_POL_MASK_LOW ~(1U << BOARD_SW1_GPIO_PIN)
#define DEMO_GINT0_POL_MASK_HIGH (1U << BOARD_SW1_GPIO_PIN)

#define DEMO_GINT0_ENA_MASK (1U << BOARD_SW1_GPIO_PIN)

 

/* Select two inputs, active low for GINT1. SW2 & SW3 must be connected to the same port */
#define DEMO_GINT1_POL_MASK_LOW ~((1U << BOARD_SW2_GPIO_PIN) | (1U << BOARD_SW3_GPIO_PIN))
#define DEMO_GINT1_POL_MASK_HIGH ((1U << BOARD_SW2_GPIO_PIN) | (1U << BOARD_SW3_GPIO_PIN))

#define DEMO_GINT1_ENA_MASK ((1U << BOARD_SW2_GPIO_PIN) | (1U << BOARD_SW3_GPIO_PIN))

 

#define DEMO_GINT1_SW2_POL_MASK_LOW    ~((1U << BOARD_SW2_GPIO_PIN))
#define DEMO_GINT1_SW2_POL_MASK_HIGH     ((1U << BOARD_SW2_GPIO_PIN))
#define DEMO_GINT1_SW2_ENA_MASK                ((1U << BOARD_SW2_GPIO_PIN))

#define DEMO_GINT1_SW3_POL_MASK_LOW     ~((1U << BOARD_SW3_GPIO_PIN))
#define DEMO_GINT1_SW3_POL_MASK_HIGH      ((1U << BOARD_SW3_GPIO_PIN))
#define DEMO_GINT1_SW3_ENA_MASK                ((1U << BOARD_SW3_GPIO_PIN))

 

....

 

/* Initialize GINT0 & GINT1 */
GINT_Init(GINT0);
GINT_Init(GINT1);

/* Setup GINT0 for edge trigger, "OR" mode */
GINT_SetCtrl(GINT0, kGINT_CombineOr, kGINT_TrigEdge, gint0_callback);

/* Setup GINT1 for edge trigger, "OR" mode */
GINT_SetCtrl(GINT1, kGINT_CombineOr, kGINT_TrigEdge, gint1_callback);


/* Select pins & polarity for GINT0 */

//GINT_ConfigPins(GINT0, DEMO_GINT0_PORT, DEMO_GINT0_POL_MASK_LOW, DEMO_GINT0_ENA_MASK); // GPIO0, pin 5, SW1
//GINT_ConfigPins(GINT0, DEMO_GINT0_PORT, DEMO_GINT0_POL_MASK_HIGH, DEMO_GINT0_ENA_MASK); // GPIO0, pin 5, SW1

GINT_ConfigPins(GINT0, DEMO_GINT1_PORT, DEMO_GINT1_POL_MASK_HIGH, DEMO_GINT1_ENA_MASK); //
//GINT_ConfigPins(GINT0, DEMO_GINT1_PORT, DEMO_GINT1_POL_MASK_LOW, DEMO_GINT1_ENA_MASK);

 


/* Select pins & polarity for GINT1 */
//GINT_ConfigPins(GINT1, DEMO_GINT0_PORT, DEMO_GINT0_POL_MASK_HIGH, DEMO_GINT0_ENA_MASK); // GPIO0, pin 5, SW1
//GINT_ConfigPins(GINT1, DEMO_GINT0_PORT, DEMO_GINT0_POL_MASK_LOW, DEMO_GINT0_ENA_MASK); // GPIO0, pin 5, SW1

GINT_ConfigPins(GINT1, DEMO_GINT1_PORT, DEMO_GINT1_POL_MASK_LOW, DEMO_GINT1_ENA_MASK); // Port1, pins 9, 18
//GINT_ConfigPins(GINT1, DEMO_GINT1_PORT, DEMO_GINT1_POL_MASK_HIGH, DEMO_GINT1_ENA_MASK); // Port1, pins 9, 18

 

 

/* Enable callbacks for GINT0 & GINT1 */
GINT_EnableCallback(GINT0);
GINT_EnableCallback(GINT1);

 

 

// This compination works, e.g bot edges detected for ISP pin and falling edges for SW2 and SW3 pins.

 GINT_ConfigPins(GINT0, DEMO_GINT0_PORT, DEMO_GINT0_POL_MASK_HIGH, DEMO_GINT0_ENA_MASK); // GPIO0, pin 5, SW1

 

GINT_ConfigPins(GINT1, DEMO_GINT0_PORT, DEMO_GINT0_POL_MASK_LOW, DEMO_GINT0_ENA_MASK); // GPIO0, pin 5, SW1

GINT_ConfigPins(GINT1, DEMO_GINT1_PORT, DEMO_GINT1_POL_MASK_LOW, DEMO_GINT1_ENA_MASK); // Port1, pins 9, 18

 

I mean if you have example for EVK where both edges are detected for all 3 buttons ( ISP, SW2 and SW3), it would be perfect answer.

 

 

Could you suggest how-to allocate multiple pins from GPIO1 port for be able to detect rising and falling edges

?

 

Regards,

Eugene

Attachments

Outcomes