你好,
I'm trying to generate external interrupt for LIS2DE12 for motion detection but while OS_TASK_NOTIFY_WAIT() it's doing Starting CPU target…并且我无法得到OS_TASK_NOTIFY_WAIT的通知值,你可以帮我吗?
这是我的中断生成配置..
空白wakeup_interrupt_cb(空白)
{
hw_wkup_reset_interrupt ();
OS_TASK_NOTIFY_FROM_ISR (acc_main_h 0 x1, OS_NOTIFY_SET_BITS);
}
static void LIS2_WakeupEventsTask(void *pvParameters)
{
int8_t wdog_id;
OS_BASE_TYPE ret;
uint32_t ulNotifiedValue;
lis2de12_int1_src_t src;
/*加速计中断引脚*/
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);
hw_wkup_init(空);
hw_wkup_configure_pin (HW_GPIO_PORT_0 HW_GPIO_PIN_12,真的,HW_WKUP_PIN_STATE_LOW);
hw_wkup_register_gpio_p0_interrupt (wakeup_interrupt_cb, 1);
/*开启WKUP控制器的中断*/
hw_wkup_enable_irq ();
/*加速计i2c配置*/
li2de12_hdl = ad_i2c_open (LI2DE12);
sensor_init (li2de12_hdl);
enableWakeUpDetect (li2de12_hdl);
/*将ble_multi_link任务注册为看门狗监控*/
wdog_id = sys_watchdog_register(假);
(,) {
printf (" LIS2_WakeupEventsTask任务\r\n");
/*在每个循环中通知watchdog */
sys_watchdog_notify (wdog_id);
/*暂停watchdog while blocking on OS_TASK_NOTIFY_WAIT() */
sys_watchdog_suspend (wdog_id);
/*等待任何一个通知位,然后清除它们*/
ret = OS_TASK_NOTIFY_WAIT(0, OS_TASK_NOTIFY_ALL_BITS, & ulnotiffiedvalue, OS_TASK_NOTIFY_FOREVER);
/* This必须永远阻塞,直到收到任务通知。所以,
返回值必须为OS_TASK_NOTIFY_SUCCESS */
OS_ASSERT (ret = = OS_TASK_NOTIFY_SUCCESS);
/*在轮询模式下读取INT pin1
*或读取SRC状态寄存器
*/
如果(ulNotifiedValue & 0 x1)
{
lis2de12_int1_gen_source_get (li2de12_hdl src);
如果(src)。xh | | src。本产品| | 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);
}
其他的
{
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);
}
}
感谢和问候,
Zinal。
嗨Zinal,
如果我理解正确的话,您想要完成的是通过一个来自LIS2DE12的外部中断唤醒DA1469x。我的假设正确吗?
我建议先检查一下DA1469x教程外部中断.
本教程的主要目标是:
谢谢,PM_Dialog
你好PM_Dialog,
是的,你的理解是正确的,我也跟进了DA1469x教程外部中断对于我的任务,它是启动CPU…这是我的问题,为什么会发生这样的事情??还有我写的是对还是错?我的案子没有调用中断处理程序。什么问题? ?
这是我修改的中断代码。。这个中断处理器在运动检测时没有被调用。
空白wakeup_interrupt_cb(空白)
{
hw_wkup_reset_interrupt ();
uint32_t状态;
/*读取PORT0状态*/
状态= hw_wkup_get_status (HW_GPIO_PORT_0);
/*检查POTR0的状态*/
if (status & (1 << HW_GPIO_PIN_12)) {
/*通知主任务*/
OS_TASK_NOTIFY_FROM_ISR (acc_main_h 0 x1, OS_NOTIFY_SET_BITS);
/*清除锁存状态*/
hw_wkup_clear_status(KEY1_PORT, (1 << HW_GPIO_PIN_12));
/*检查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(空);
hw_wkup_register_gpio_p0_interrupt (wakeup_interrupt_cb, 1);
hw_wkup_gpio_configure_pin (HW_GPIO_PORT_0 HW_GPIO_PIN_12,真的,HW_WKUP_PIN_STATE_LOW);
/*开启WKUP控制器的中断*/
hw_wkup_enable_irq ();
enableWakeUpDetect (li2de12_hdl);
/*将ble_multi_link任务注册为看门狗监控*/
// wdog_id = sys_watchdog_register(false);
(,) {
printf (" LIS2_WakeupEventsTask任务\r\n");
/*在每个循环中通知watchdog */
sys_watchdog_notify (wdog_id);
/*暂停watchdog while blocking on OS_TASK_NOTIFY_WAIT() */
sys_watchdog_suspend (wdog_id);
/*等待任何一个通知位,然后清除它们*/
ret = OS_TASK_NOTIFY_WAIT(0, OS_TASK_NOTIFY_ALL_BITS, & ulnotiffiedvalue, OS_TASK_NOTIFY_FOREVER);
/* This必须永远阻塞,直到收到任务通知。所以,
返回值必须为OS_TASK_NOTIFY_SUCCESS */
OS_ASSERT (ret = = OS_TASK_NOTIFY_SUCCESS);
/*在轮询模式下读取INT pin1
*或读取SRC状态寄存器
*/
如果(ulNotifiedValue & 0 x1)
{
lis2de12_int1_gen_source_get (li2de12_hdl src);
如果(src)。xh | | src。本产品| | 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);
}
其他的
{
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);
}
}
prvsetuhardware (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), 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);
/*初始化硬件*/
/* ' peripher_init()'将被自动调用
*现在和在设备的每一个唤醒*/
pm_system_init (periph_init);
/*在处理任何GPIO管脚之前启用COM电源域*/
hw_sys_pd_com_enable ();
/*加速计中断引脚*/
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);
/*处理GPIO引脚后关闭COM电源域*/
hw_sys_pd_com_disable ();
}
嗨Zinal,
谢谢你的评论。
我已经在以下论坛帖子回复了你:
https://support.dialog-semiconductor.com/forums/post/dialog-smartbond-bluetooth-low-energy-%E2%80%93-software/da1469x-external-interrupt-not-invoking
谢谢,PM_Dialog