DA1469x External Interrupt - not invoking interrupt handler while interrupt

了解更多FAQsTutorials

9个帖子/ 0新
Last post
Zinal
Offline
Last seen:6天前1周
Joined:2020-09-23 08:58
DA1469x External Interrupt - not invoking interrupt handler while interrupt

Hello Dialog,

我在DA1469x上通过LIS2DE12生成外部中断。我的问题是当设备移动或检测到的动作时未调用中断处理程序。

I have followed upDA1469X教程外部中断教程。

Here i'm sharinf code which i have implemented for this..Please help me in this what is issue in these??

void wakeup_interrupt_cb(void)
{
hw_wkup_reset_interrupt();

UINT32_T状态;

/ *Read the status of PORT0 */
status = hw_wkup_get_status(hw_gpio_port_0);

/ *Check the status of POTR0 */
if (status & (1 << HW_GPIO_PIN_12)) {
/ *Notify the main task */
OS_TASK_NOTIFY_FROM_ISR(acc_main_h, 0x1, OS_NOTIFY_SET_BITS);

/ *清除闩锁状态* /
hw_wkup_clear_status(HW_GPIO_PORT_0, (1 << HW_GPIO_PIN_12));
/ *Check the status of POTR0 */
}
}
static void LIS2_WakeupEventsTask( void *pvParameters )
{
Int8_t wdog_id;
OS_BASE_TYPE RET;
uint32_t ulNotifiedValue;
lis2de12_int1_src_t src;

hw_wkup_init(null);
hw_wkup_register_gpio_p0_interrupt (wakeup_interrupt_cb, 1);
hw_wkup_gpio_configure_pin(HW_GPIO_PORT_0,HW_GPIO_PIN_12, true, HW_WKUP_PIN_STATE_LOW);

/ *Enable interrupts of WKUP controller */
hw_wkup_enable_irq();

enableWakeUpDetect(li2de12_hdl);

/ *Register ble_multi_link task to be monitored by watchdog */
wdog_id = sys_watchdog_register(false);

for (;;) {

printf (" LIS2_WakeupEventsTask Task \r\n");

/ *Notify watchdog on each loop */
sys_watchdog_notify(wdog_id);

/ *Suspend watchdog while blocking on OS_TASK_NOTIFY_WAIT() */
sys_watchdog_suspend(wdog_id);

/ *等待任何通知位,然后清除所有* /
ret = OS_TASK_NOTIFY_WAIT(0, OS_TASK_NOTIFY_ALL_BITS, &ulNotifiedValue, OS_TASK_NOTIFY_FOREVER);

/ *This must block forever, until a task notification is received. So, the
返回值必须是OS_TASK_NOTIFY_SUCCESS * /
os_assert(ret == os_task_notify_success);

/ *Read INT pin 1 in polling mode
* or read src status register
* /
if(ulNotifiedValue & 0x1)
{
lis2de12_int1_gen_source_get(li2de12_hdl, &src);
if (src.xh || src.yh || src.zh)
{
hw_gpio_set_inactive(HW_GPIO_PORT_0, HW_GPIO_PIN_24);
hw_gpio_pad_latch_enable(HW_GPIO_PORT_0, HW_GPIO_PIN_24);
hw_gpio_pad_latch_disable(HW_GPIO_PORT_0,HW_GPIO_PIN_24);
enableWakeUpDetect(li2de12_hdl);
}
else
{
hw_gpio_set_active(hw_gpio_port_0,hw_gpio_pin_24);
hw_gpio_pad_latch_enable(HW_GPIO_PORT_0, HW_GPIO_PIN_24);
hw_gpio_pad_latch_disable(HW_GPIO_PORT_0,HW_GPIO_PIN_24);
enableInactivityDetect(li2de12_hdl);

}
}
/ *Main Application */
sys_watchdog_notify_and_resume(wdog_id);
}

}

static void prvSetupHardware( void )
{

hw_gpio_pad_latch_disable_all();// ......避免任何未使用的浮动引脚。

/ *
*添加PDC LUT条目,以便在Port0上的事件后唤醒M33核心
*这很重要,因为当设备进入睡眠时M33关闭。
* /
uint32_t pdc_wkup_gpio_id_1 = hw_pdc_add_entry(HW_PDC_LUT_ENTRY_VAL(HW_GPIO_PORT_0,
hw_gpio_pin_12,hw_pdc_master_cm33,0));
OS_ASSERT(pdc_wkup_gpio_id_1 != HW_PDC_INVALID_LUT_INDEX);

/ *做诀窍!* /
hw_pdc_set_pending(pdc_wkup_gpio_id_1);
hw_pdc_acknowledge(pdc_wkup_gpio_id_1);
/ *Init hardware */
/ *The 'periph_init()' will be called automatically
* now and on every wake-up of the device */
PM_SYSTEM_INIT(PERIPH_INIT);

/ *Enable the COM power domain before handling any GPIO pin */
hw_sys_pd_com_enable();

/ *Accelerometer Interrupt Pins */
hw_gpio_configure_pin(hw_gpio_port_0,hw_gpio_pin_12,hw_gpio_mode_input_pullup,hw_gpio_func_gpio,true);// Accelerometer_Int1.
hw_gpio_pad_latch_enable(HW_GPIO_PORT_0, HW_GPIO_PIN_12);
hw_gpio_pad_latch_disable(hw_gpio_port_0,hw_gpio_pin_12);

/ *Disable the COM power domain after handling the GPIO pins */
hw_sys_pd_com_disable();
}

Thanks & Regards,

Zinal.

设备:
PM_Dialog
Offline
Last seen:5 hours 18 min ago
Staff
Joined:2018-02-08 11:03
Hi Zinal,

Hi Zinal,

Thanks for your question. It seems that the wake-up controller is configured correctly. Could you please try to use the hw_wkup_configure_pin() instead of hw_wkup_gpio_configure_pin() in the LIS2_WakeupEventsTask()? Please also set the debouncing time same as the wkup_init() from the tutorial.

此外,如果探测P0_12(唤醒引脚),您是否能够在LIS2DE12生成中断时检测下降沿?LIS2DE12是否会产生上升或下降的边缘中断?

谢谢,PM_Dialog

Zinal
Offline
Last seen:6天前1周
Joined:2020-09-23 08:58
你好PM_DIALOG.

你好PM_DIALOG.

Yes i have tried with the hw_wkup_configure_pin() and also debouncing time is for KEY_WAKUP interrupt and i'm using GPIO_WAKEUP interrupt for this might not be given debounce time in BSP tutorial of DA1469x mentioned for wakeup controller and then also i added debounce time but there is no effect on my device with that also.

And i would like to know from you that how can we probe P0_12 from software beacuse i'm doing it first time so i don't know how to ?can you help for it??

Thanks & Regards,

Zinal.

PM_Dialog
Offline
Last seen:5 hours 18 min ago
Staff
Joined:2018-02-08 11:03
Hi Zinal,

Hi Zinal,

我在先前的评论中的意思是使用逻辑分析工具或万用表探测P0_12引脚。你能检测到中断吗?销的状态是什么?

谢谢,PM_Dialog

Zinal
Offline
Last seen:6天前1周
Joined:2020-09-23 08:58
你好pm_dialog,

你好pm_dialog,

I'm able to verify the state of pin through hw_get_pin_status() and also pin status getting changed while device motion detect beacuse i have configured interrupt for the motion detect but interrupt_handler not getting called after that.

谢谢,

Zinal.

Zinal
Offline
Last seen:6天前1周
Joined:2020-09-23 08:58

你好pm_dialog,

can you respond me for this issue?? It'll be helpful.

我能够获得PIN状态,引脚状态正在更改,而GPIO P0_12的设备的运动检测,但不执行Interrupt_Handler仍在等待中断。

I debug this GPIO P0_12 with hw_get_pin_status() befor waiting for interrupt and it's going high whenever device is moved.

我无法在中断配置中获得可能存在的问题。

I'm using USB Pro Kit so not able to debug through logic analyzer.

谢谢,

Zinal.

PM_Dialog
Offline
Last seen:5 hours 18 min ago
Staff
Joined:2018-02-08 11:03
Hi Zinal,

Hi Zinal,

Could you please run it in debug mode?

What is the state of the pin when the interrupt is generated? Is it high or low?

谢谢,PM_Dialog

Zinal
Offline
Last seen:6天前1周
Joined:2020-09-23 08:58
你好pm_dialog,

你好pm_dialog,

感谢您的答复。

Now I'm able to get the inetrrupt i changed below line

hw_wkup_gpio_configure_pin(HW_GPIO_PORT_0,HW_GPIO_PIN_12, true, HW_WKUP_PIN_STATE_LOW);

with hw_wkup_gpio_configure_pin(HW_GPIO_PORT_0,HW_GPIO_PIN_12, true, HW_WKUP_PIN_STATE_HIGH); now it's working.

I have more one question

我如何将设备放在设备上没有移动和宽度移动时的设备睡觉,这是可能的吗??

谢谢,

Zinal.

PM_Dialog
Offline
Last seen:5 hours 18 min ago
Staff
Joined:2018-02-08 11:03
Hi Zinal,

Hi Zinal,

Glad that you can wake it up! The problem was the wake-up pin polarity.

>> How can I put the device to sleep on the device not moving and wakup when it moves with Sleep modes is it possible??

你能澄清你的新要求吗?

谢谢,PM_Dialog