I have a LLWU set up on PTB0/LLWU_P5 which works fine, generates the interrupt. I tried adding another one on PTE4/LLWU_P2 without any success.
My setup code is,
LLWU_PE1_WUPE2(0x03) in init_lpm.c under LPM_OPERATION_MODE_STOP
GPIOE_PDDR 0x00000000;
#define TW_WAKE_ID (GPIO_PORT_E | GPIO_PIN4)
#define TW_WAKE_MUX LWGPIO_MUX_E4_GPIO
My initialisation code is,
static void tw_isr (void *pin)
{
// lwgpio_toggle_value (&led1);
lwgpio_int_clear_flag (pin);
_lwevent_set (&app_event, PIN_EVENT_MASK);
}
static void tw_interrupt_init (void)
{
static LWGPIO_STRUCT sw;
printf("Going to init tw interrupt\n");
//PTE4 llwu p2
//************************************************************************************
/* Set the pin to input */
if (!lwgpio_init(&sw, TW_WAKE_ID, LWGPIO_DIR_INPUT, LWGPIO_VALUE_NOCHANGE))
{
printf("\nSW initialization failed.\n");
_task_block();
}
/* Set functionality to GPIO mode */
lwgpio_set_functionality(&sw, TW_WAKE_MUX);
/* Enable pull up */
lwgpio_set_attribute(&sw, LWGPIO_ATTR_PULL_UP, LWGPIO_AVAL_ENABLE);
/* Setup the pin interrupt mode */
if (!lwgpio_int_init(&sw, LWGPIO_INT_MODE_FALLING))
{
printf("Initializing SW for interrupt failed.\n");
_task_block();
}
/* Install gpio interrupt service routine */
_int_install_isr(lwgpio_int_get_vector(&sw), tw_isr, (void *) &sw);
/* Set interrupt priority and enable interrupt source in the interrupt controller */
_bsp_int_init(lwgpio_int_get_vector(&sw), 3, 0, TRUE);
/* Enable interrupt for pin */
lwgpio_int_enable(&sw, TRUE);
}
void initLowPower()
{
//configure pin interrupts
tw_interrupt_init();
_int_install_unexpected_isr();
_lpm_register_wakeup_callback(BSP_LLWU_INTERRUPT_VECTOR, BSP_LLWU_INTERRUPT_PRIORITY, NULL);
/* Install interrupt for timer wakeup */
install_timer_interrupt();
/* Create global event */
if (_lwevent_create(&app_event, 0) != MQX_OK)
{
printf("\nCreating app_event failed.\n");
_task_block();
}
if (_lpm_get_reset_source() != MQX_RESET_SOURCE_LLWU)
printf("\nNormal hardware wakeup\n");
else
printf("\nWake up by reset from LLWU\n");
}
The llwu code on the PORTB seems to work fine and is similar, not sure if there are any bsp specific changes needed for PORTE llwu.
Thanks,
Rahul