hw_wkup_reset_interrupt can not reset interrupt, keep looping and hang

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.wsdof.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
2 posts / 0 new
Last post
Ken Chong
Offline
Last seen:2 years 8 months ago
加入:2016-10-15 05:40
hw_wkup_reset_interrupt can not reset interrupt, keep looping and hang

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

Device:
MT_dialog
Offline
Last seen:2 months 1 week ago
Staff
加入:2015-06-08 11:34
Hi Ken Chong,

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