Dear sir,
I just setup a demo in the development kit when K1 press showing debug msg in retarget uart, however once button press, the interrupt is keep running and never reset, what should i do? Thanks
the code as below:
static void periph_init(void)
...
printf("hw_wkup_init\r\n");
hw_wkup_init(NULL);
/*
* Default value for counter threshold is 0. It's important to change this value before
* interrupt is registered as otherwise interrupt will be triggered indefinitely due to
* counter value being equal to threshold.
*/
hw_wkup_set_counter_threshold(1);
hw_wkup_register_interrupt(wkup_intr_cb, 1);
hw_gpio_set_pin_function (HW_GPIO_PORT_1 HW_GPIO_PIN_6, HW_GPIO_MODE_INPUT_PULLUP, HW_GPIO_FUNC_GPIO); //button K1
hw_wkup_configure_pin(HW_GPIO_PORT_1, HW_GPIO_PIN_6, true, HW_WKUP_PIN_STATE_LOW);
}
static void wkup_intr_cb(void)
{
hw_wkup_reset_interrupt();
printf("Wake up interrupt triggered\r\n");
}
Result:
Wake up interrupt triggered
Wake up interrupt triggered
Wake up interrupt triggered
Wake up interrupt triggered
Wake up interrupt triggered
Wake up interrupt triggered
Wake up interrupt triggered
Wake up interrupt triggered
Wake up interrupt triggered
Wake up interrupt triggered
Wake up interrupt triggered
Wake up interrupt triggered
.... x n times and hang
Hi Ken Chong,
From what you are reporting i would say that you dont reset the interrupt when its triggered, but i can see that in the callback you invoke the hw_wkup_reset_interrupt(); so please check if the device is indeed resets the interrupt when the callback hits and also check the status of the line that triggers the interrupt, perhaps this is what triggers the interrupt over and over again. Also the hrp_sensor example has an implementation on how to implement the external interrupt function, so please take a look at that example.
Thanks MT_dialog