您好,
我正在尝试为LIS2DE12生成外部中断,用于运动检测,但是在OS_TASK_NOTIFY_WAIT()它正在执行启动CPU目标......我无法为OS_TASK_NOTIFY_WAIT获取通知值.CAN,您可以帮助我吗?
here is my configuration for interrupt generation..,
void wakeup_interrupt_cb(void)
{
hw_wkup_reset_interrupt();
OS_TASK_NOTIFY_FROM_ISR(ACC_MAIN_H,0x1,OS_NOTIFY_SET_BITS);
}
静态void lis2_wakeupeventstask(void * pvparameters)
{
Int8_t wdog_id;
OS_BASE_TYPE RET;
UINT32_T ULNOTIFIONVALUE;
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(NULL);
hw_wkup_configure_pin(hw_gpio_port_0,hw_gpio_pin_12,true,hw_wkup_pin_state_low);
hw_wkup_register_gpio_p0_interrupt(wakeup_interrupt_cb,1);
/ *启用WKUP控制器的中断* /
hw_wkup_enable_irq();
/ * Accelerometer-I2C配置* /
li2de12_hdl = ad_i2c_open(li2de12);
sensor_init(li2de12_hdl);
启用WakeUpdetect(Li2DE12_HDL);
/ *寄存器BLE_MULTI_LINK任务由看门狗监视* /
wdog_id = sys_watchdog_register(false);
for(;;){
printf(“lis2_wakeupeventstask任务\ r \ n”);
/ *在每个循环上通知看门狗* /
sys_watchdog_notify(wdog_id);
/ *在OS_TASK_NOTIFY_WAIT()屏蔽时暂停看门狗* /
sys_watchdog_suspend(wdog_id);
/ *Wait on any of the notification bits, then clear them all */
RET = OS_TASK_NOTIFY_WAIT(0,OS_TASK_NOTIFY_ALL_BITS,&ulnotifiedValue,OS_TASK_NOTIFY_FOREVER);
/ *这必须永远阻止,直到收到任务通知。所以
返回值必须是OS_TASK_NOTIFY_SUCCESS * /
os_assert(ret == os_task_notify_success);
/ *读取轮询模式的int引脚1
*或读取SRC状态寄存器
* /
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);
启用WakeUpdetect(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);
}
}
/ *主要申请* /
sys_watchdog_notify_and_resume(wdog_id);
}
}
感谢和问候,
zinal。
嗨zinal,
如果我理解正确的话,你想要什么accomplish is to wake-up the DA1469x via an external interrupt from the LIS2DE12. Is my assumption correct?
我建议首先检查DA1469X教程外部中断。
本教程的关键目标是:
谢谢,PM_DIALOG.
你好pm_dialog,
是的,你已经理解正确,我也跟着这个DA1469X教程外部中断这项任务的同一教程。对于我的任务,它正在启动CPU ...再次在OS_TASK_NOTIFY_WAIT()这是我的问题,为什么它发生如此???而且我写的方式是正确的或错误的?中断处理程序未呼叫我的情况。问题是什么?
and here is my modified code for interrupt.. and with this also interrupt handler not getting called when motion is detect.
void wakeup_interrupt_cb(void)
{
hw_wkup_reset_interrupt();
uint32_t status;
/ *读取port0 * /
status = hw_wkup_get_status(HW_GPIO_PORT_0);
/ *检查potr0 * /
if(status&(1 << hw_gpio_pin_12)){
/ *通知主要任务* /
OS_TASK_NOTIFY_FROM_ISR(ACC_MAIN_H,0x1,OS_NOTIFY_SET_BITS);
/ *Clear the latch status */
hw_wkup_clear_status(key1_port,(1 << HW_GPIO_PIN_12));
/ *检查potr0 * /
}
}
静态void lis2_wakeupeventstask(void * pvparameters)
{
Int8_t wdog_id;
OS_BASE_TYPE RET;
UINT32_T ULNOTIFIONVALUE;
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);
/ *启用WKUP控制器的中断* /
hw_wkup_enable_irq();
启用WakeUpdetect(Li2DE12_HDL);
/ *寄存器BLE_MULTI_LINK任务由看门狗监视* /
// wdog_id = sys_watchdog_register(false);
for(;;){
printf(“lis2_wakeupeventstask任务\ r \ n”);
/ *在每个循环上通知看门狗* /
sys_watchdog_notify(wdog_id);
/ *在OS_TASK_NOTIFY_WAIT()屏蔽时暂停看门狗* /
sys_watchdog_suspend(wdog_id);
/ *Wait on any of the notification bits, then clear them all */
RET = OS_TASK_NOTIFY_WAIT(0,OS_TASK_NOTIFY_ALL_BITS,&ulnotifiedValue,OS_TASK_NOTIFY_FOREVER);
/ *这必须永远阻止,直到收到任务通知。所以
返回值必须是OS_TASK_NOTIFY_SUCCESS * /
os_assert(ret == os_task_notify_success);
/ *读取轮询模式的int引脚1
*或读取SRC状态寄存器
* /
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);
启用WakeUpdetect(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);
}
}
/ *主要申请* /
sys_watchdog_notify_and_resume(wdog_id);
}
}
静态void prvsetuphardware(void)
{
hw_gpio_pad_latch_disable_all();// ......避免任何未使用的浮动引脚。
/ *
*Add a PDC LUT entry so that to wake up the M33 core following an event on PORT0
*这很重要,因为当设备进入睡眠时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硬件* /
/ *将自动调用'periph_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-semicondiondiondimics.com/forums/post/dialog-smartbond-bluetooth-low-energy-%2%80%93-software/da1469x-external-interrupt-not-invoking.
谢谢,PM_DIALOG.