按钮按5秒唤醒睡眠模式

⚠️
嗨,...感谢您来论坛。令人兴奋的消息!我们现在正在迁至我们的新论坛平台,将提供更好的功能,并包含在主对话框网站中。所有帖子和帐户都已迁移。我们现在只接受新论坛上的流量 - 请发布任何新线程https://www.dialog-seminile.com/support.。我们将在未来几天修复错误/优化搜索和标记。
15 posts / 0 new
最后一篇
powersquare
离线
最后一次露面:5个月4周前
加入:2018-12-27 04:15
按钮按5秒唤醒睡眠模式

Dear Dialog team,

We need to detect long press button on DA14683 and we are using SDK 1.0.14.1081. We use K1 button for this operation.

我们能够使用计数器检测5秒操作,并使系统转到睡眠模式。

现在,我们需要从睡眠模式唤醒系统,按下按钮5秒钟。我们能够唤醒系统进行正常压力机(如触摸和释放按钮)。

Can you suggest any example code for this operation or can you suggest flow how to do this?

此致

Malli

Device:
PM_DIALOG.
离线
最后一次露面:3天23小时前
职员
加入:2018-02-08 11:03
Hi powersquare,

Hi powersquare,

按下按钮5秒钟时,您无法唤醒DA14683。请参阅wkup_ctrl_reg描述中的数据表。您可以通过使用适当值设置WKUP_DEB_VALUE位字段来配置逐个64毫秒的逐个次序时间。当系统处于主动模式时,可以实现具有5秒持续时间的“长按钮”实现,如您帖子中提到的。

谢谢,PM_DIALOG.

powersquare
离线
最后一次露面:5个月4周前
加入:2018-12-27 04:15
嗨对话小组,我们的目标

嗨对话小组,我们的目标如下。

1. Put the controller to hinbernate mode after the button is pushed for 5 sec long.

2. Wake the controller up form the hibernate mode after the button is pushed for 5 sec long.

当按下按钮后,控制器在秒后立即唤醒即时,这是不希望的,因为这可能是Accenteplent Press。

在按下按钮5秒后,您可以让我们知道如何从Hibernate模式实现唤醒唤醒吗?

Best Regards,

Malli

PM_DIALOG.
离线
最后一次露面:3天23小时前
职员
加入:2018-02-08 11:03
Hi powersquare,

Hi powersquare,

在我之前的评论中提到,在按下按钮后从Hibernate模式下唤醒控制器5秒,不可能实现。关于您的第一个要求,如果您需要支持,或者您已经实施过它,请您告诉我吗?

谢谢,PM_DIALOG.

powersquare
离线
最后一次露面:5个月4周前
加入:2018-12-27 04:15
Dear Dialog team,

Dear Dialog team,

谢谢您的支持。

For first requirement, we plan to implement like delay for 5 sec and check if button is still pressed or not. If its pressed, then go to hibernation or else continue with same state. We plan to do like below:

/ *设置k1按钮的唤醒控制器,如下* /

hw_wkup_set_debounce_time(63);

hw_wkup_set_pin_state(HW_GPIO_PORT_1, HW_GPIO_PIN_6, true);

hw_wkup_set_pin_trigger(hw_gpio_port_1,hw_gpio_pin_6,hw_wkup_pin_state_low);

hw_wkup_register_interrupt(wkup_handler, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);

/ * wkup_handler()* /

运行循环5次// for循环

{

延迟(1000 ms)// os_delay_ms(1000);

检查按钮状态// hw_gpio_get_pin_status(hw_gpio_port_1,hw_gpio_pin_6);

如果(低){循环}

否则{设置标志并打破循环}

}

if (flag not set)

{

pm_set_sleep_mode(pm_mode_hibernation);

}

上面的方法好吗?您是否建议了其他方法?

OS_DELAY_MS()函数在唤醒中断处理程序中工作吗?如果没有,任何其他替代解决方案。

此致

Malli

PM_DIALOG.
离线
最后一次露面:3天23小时前
职员
加入:2018-02-08 11:03
Hi powersquare,

Hi powersquare,

You can do that with a software implemented approach, by polling a GPIO and check with a counter if the button is pressed for 5 sec. Be aware that in case of waking up from hibernation, the device will wake up before the expiration of the 5 sec, so if the button is pressed more than 5 sec the device will stay in active mode, otherwise it will enter the hibernation again. In case of the active mode, you have to check the value of the counter, and only if the button is pressed for 5sec the chip will enter the hibernation mode.

谢谢,PM_DIALOG.

powersquare
离线
最后一次露面:5个月4周前
加入:2018-12-27 04:15
Dear Dialog team,

Dear Dialog team,

谢谢您的支持。

We implemented the first requirement, i.e. put the controller to hibernate mode, and it works fine.

对于第二个要求,即HiberBate唤醒,因为软件方法不起作用,您是否可以建议使用硬件定时器或kernal定时器进行此功能的其他方法。您能否为此建议任何示例代码?

此致

Malli

PM_DIALOG.
离线
最后一次露面:3天23小时前
职员
加入:2018-02-08 11:03
Hi powersquare,

Hi powersquare,

正如我之前提到的那样,在按下按钮5秒后,不可能从休眠模式唤醒设备。该芯片将较早从5秒醒来。

谢谢,PM_DIALOG.

powersquare
离线
最后一次露面:5个月4周前
加入:2018-12-27 04:15
Dear Dialog team,

Dear Dialog team,

谢谢您的支持。

For the first requirement, (Put the controller to hibernate mode after the button is pushed for 5 sec long), we tested this functionality with extended_sleep project and this works fine. When K1 button is pressed for 5 secs, the system goes to hibernate mode.

现在我们在ble_perip测试这个功能heral project. We configured K1 button pin and ported timer functionality from extended_sleep project (main.c) to ble_peripheral project main.c file. We attached main.c file of ble_peripheral project for your reference. There is no change made in SDK and in ble_peripheral project. Only change made is in main.c file to configure button and timer functionality.

When we tested this functionality (when we press K1 button for 5 secs), the system goes to hibernate and immediately wakes up. We don't want the system to wake up immediately. We also tested with this setting in main.c file, pm_set_wakeup_mode(false), but issue remains same.

您可以帮助我们解决BLE_PERITWEL项目中的此问题。

此致

Malli

附件:
powersquare
离线
最后一次露面:5个月4周前
加入:2018-12-27 04:15
Dear Dialog team,

Dear Dialog team,

Do you have any update on this?

此致

Malli

PM_DIALOG.
离线
最后一次露面:3天23小时前
职员
加入:2018-02-08 11:03
Hi powersquare,

Hi powersquare,

Apologies for the delay. I used your attached code (main.c), and I replicated your issue working on the DA14683 SoC and SDK1.0.14.1081. With the same main.c file, the issue does not exist when using DA14681 SoC instead of DA14683. Please take a look at the apply_wfi() function in sdk/cpm/sys_power_mgr.c. The revision A (BLACK_ORCA_IC_REV_A) is applicable for the DA14681 devices and the revision B (BLACK_ORCA_IC_REV_B) is for DA14683 devices. In line 1393 of the sys_power_mgr.c file, if the DA14681 (BLACK_ORCA_IC_REV_A) is being used, before going to hibernation, all the IRQs are disabled and all pending interrupts are cleared except from VBUS and WKUP, so that the system is not reset by an already pending interrupt. This is applicable only in DA14681 devices. To do so, when using the DA14683 device, the pending interrupts are never cleared because the if-statement will always be false. As a result, the system after going to hibernation, it will immediately wake-up due to a pending interrupt. Also, keep in mind that in ble_peripheral example of the SDK, you will have BLE activity, so the most possible reason for waking up is due to a pending BLE interrupt, in contrast with extended_sleep example. A possible workaround might be to modify the source code of sys_power_mgr.c in order to explicitly clear all the pending interrupts in case of DA14683. Please check a reference code snippet:

if(dg_configblack_orca_ic_rev == black_orca_ic_rev_a){// da14681 / *扩展代码* /} else {// da14683 / * *禁用所有IRQ,除了WKUP(如果由*应用程序使用)。* / uint32_t iser;iser = nvic-> iser [0];nvic-> icer [0] = iser&〜((uint32_t)(1 << wkup_gpio_irqn);/ * *清除除WKUP之外的所有中断(如果应用程序使用),以便在已挂起的中断未重置系统。* / nvic-> ICPR [0] = iser&〜((uint32_t)(1 << wkup_gpio_irqn);}

In case of DA14683, all the pending interrupts are cleared except from WKUP because the chip can be woken up only from the WAKEUP controller and not from the VBUS. Please note that this is just a possible workaround which is not tested by the SDK team.

另一个解决方法是在将芯片放入休眠模式之前停止广告并停止任何其他BLE活动。

谢谢,PM_DIALOG.

powersquare
离线
最后一次露面:5个月4周前
加入:2018-12-27 04:15
Dear Dialog team,

Dear Dialog team,

谢谢您的支持。

此解决方案似乎正常工作(在sys_power_mgr.c文件的第1393号线更改)。

您能与您的SDK团队确认这些更改吗?

此致

Malli

PM_DIALOG.
离线
最后一次露面:3天23小时前
职员
加入:2018-02-08 11:03
Hi Malli,

Hi Malli,

很高兴你想到了你的问题。如果您发现解决方法有用,请将以前的ASWER标记为已接受。我已经alredy让SDK团队知道这一点。

Regards, PM_Dialog

powersquare
离线
最后一次露面:5个月4周前
加入:2018-12-27 04:15
Dear Dialog team,

Dear Dialog team,

谢谢您的支持。

我们使用的是DA14683制造的定制板。此帖子中提到的按钮按下(5秒)在此定制板上不起作用。

The button is configured on port 4, pin4 on this board. When we press this button for 5 secs, we observed that hw_wkup_handler() function is called in hw_wkup.c file, but the call back function (intr_cb) is not called. The call back function is initialiazed in main.c using hw_wkup_register_interrupt(). In hw_wkup_handler(), the control goes inside "if (intr_cb) {" loop, but the call back is not called.

你能帮助我们解决,为什么这个回电没有被称为?

此致

Malli

PM_DIALOG.
离线
最后一次露面:3天23小时前
职员
加入:2018-02-08 11:03
Hi powersquare,