我们可以通过app_easy_timer替换timer0和timer2吗?

⚠️
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.
12 posts / 0 new
Last post
Ruchi Patel.
Offline
最后一次露面:2年5个月前
加入:2017-03-29 10:50
我们可以通过app_easy_timer替换timer0和timer2吗?

亲爱的Dialog_Support团队,

I was using Timer0 and Timer2 in my application to play buzzer sound and to calculate push button pressed time. Now i want to add sleep modes in my application and after adding extended sleep mode, timers are not working properly. I have also read different Dialog's forum posts that Timer0 and Timer2 will not work with sleep modes. So can i replace both timers by app_easy_timer? And i have configured duty cycles in Timer0,2 to play buzzer sounds. So how to set duty cycle using app_easy_timer?

感谢致敬,
Ruchi Patel.

设备:
STS_Dialog (not verified)
嗨Ruchi Patel,

嗨Ruchi Patel,

The timers 0 and 2 are hardware timers so they have he ability of generating Pulse Width Modulated signals, based on this capability you can produce buzzer sounds. There isn't the option to replace one of these two timers with app_easy_timer(software timer)

BR,
STS_Dialog.

Ruchi Patel.
Offline
最后一次露面:2年5个月前
加入:2017-03-29 10:50
亲爱的Dialog_Support团队,

亲爱的Dialog_Support团队,

对不起,我给了你错误的解释有关Timer0,2.

I want my device is in sleep mode, when there is no any interrupt from push button or App. And after device gets interrupted, Timer0,2 should awake from sleep, do its work and then again go to sleep. I don't want to run the Timer0,2 during sleep. So is it possible?

你能建议我的延长睡眠模式的任何好的和相关的例子吗?

先感谢您。

With regards,
Ruchi Patel.

mt_dialog.
Offline
最后一次露面:1 month 3 weeks ago
Staff
加入:2015-06-08 11:34
嗨Ruchi Patel,

嗨Ruchi Patel,

大部分的例子运行在延长睡眠mode, if you would like an example that would run with a press of a button, for example be in sleep mode and as soon as the button is pressed or an interrupt occurs the device would wake up you can check the ble_app_sleepmode, the original configuration is for deep sleep but you can easily change that by changing the app_default_sleep_mode from ARCH_DEEP_SLEEP_ON to ARCH_EXT_SLEEP_ON and by changing the memory configuration to CFG_MEM_MAP_EXT_SLEEP. After doing that you can set up the timer in order to generate the pwm and disable the sleep in runtime as long as you would like the device to generate the PWM, as soon as you are ready to go to sleep, disable the timers and set back the sleep mode to exteded (in order to change the sleep modes during runtime you can use arch_disable_sleep() and arch_set_exteded_sleep()).

谢谢mt_dialog.

Ruchi Patel.
Offline
最后一次露面:2年5个月前
加入:2017-03-29 10:50
亲爱的Dialog_Support团队,

亲爱的Dialog_Support团队,

Thank you for the reply. I have configured my device as per your suggestion. Now i want to know that, can advertising is possible during sleep mode? If yes then in code, where to put sleep mode function (api) if there is no any interrupt from push button or app.

感谢致敬,
Ruchi Patel.

mt_dialog.
Offline
最后一次露面:1 month 3 weeks ago
Staff
加入:2015-06-08 11:34
嗨Ruchi Patel,

嗨Ruchi Patel,

当启用睡眠模式时,它意味着当设备无法实现睡眠时,设备能够在广告或连接时段之间进行广告和睡眠,这意味着即使没有BLE活动,该设备也会保持醒索。所以简而言之,当580处于睡眠模式时,它将唤醒广告并自动睡觉。关于问题“将睡眠模式函数(API)”的问题“我不太明白,显然您想要启用PWM并保持设备在两个事件之间的某个时段内唤醒,其中一个会触发PWM事件并且一个将结束PWM并将设备发送回睡眠模式,因此当触发事件时,您将禁用睡眠并以PWM模式启动计时器,当其上方将禁用PWM并将设备发送回睡眠时。

谢谢mt_dialog.

Ruchi Patel.
Offline
最后一次露面:2年5个月前
加入:2017-03-29 10:50
亲爱的Dialog_Support团队,

亲爱的Dialog_Support团队,

Thank you for your quick reply.

1. Can you please guide me that, if my device is in extended sleep mode and device should always advertising. Is it possible? What about power consumption if device is always advertising?

2. I am working with accelerometer sensor. Sensor communicates with DA14580 via I2C. Whenever there is movement, accelerometer gives interrupt to the controller. Ideally controller should awake from sleep mode but controller not receiving any kind of interrupt from accelerometer during extended sleep mode. And its working fine in fully active mode.

3. As i press push button, device wakes up from sleep mode and then immediately it goes to sleep mode again. Due to this, my buzzer tone is not working properly. Buzzer rings very fast. How to increase wake up time or i want to finish my task then at the end of task, device goes to sleep mode again.

With Regards,
Ruchi Patel.

mt_dialog.
Offline
最后一次露面:1 month 3 weeks ago
Staff
加入:2015-06-08 11:34
嗨Ruchi Patel,

嗨Ruchi Patel,

1) Yes, being is sleep mode and wake up for advertising is possible, the power cosnumption of the device depends on how often the device is advertising (meaning how often is going to wake up and send an advertising packet). So it depends on the advertising interval and the value for the power consumption is not fixed, the more you wake up the more power you consume.

2) In order to wake up from sleep you will have to configure the wake up timer, that means that you will have to configure the wake up module of the 580 in order to wake up from an external interrupt, while the device is in sleep mode. You can check the ble_app_sleepmode project where the device wakes up from an external interrupt emulated via a button press. After you are awake, then you can perform whatever actions you would like, advertise or read the accelerometer etc. If you have configured the wake up timer properly and the device still doesn't wake up, then you should check the pollarity of the wake up signal, perhaps the debouncing that you have set etc.

3) Since the device will wake up via an external interrupt it will check if there are any pending BLE events and if there aren't any, then the device will go back to sleep, in order to prevent the device from going back to sleep, you can just invoke the arch_disable_sleep() and keep the device awake, when its time to go back to sleep you can invoke the arch_set_extended_sleep() also another way of doing that is to leave the sleeping state as is and prevent the device from going to sleep via applying some custom code in the app_on_ble_powered() or in the app_on_system_powered() callbacks and return conditionally either KEEP_POWERED (in order to prevent the device from going to sleep) or GOTO_SLEEP (allowing the device to go to sleep). So you can keep the device awake as long as you would like the buzzer to ring and go to sleep whenever you are ready.

谢谢mt_dialog.

Ruchi Patel.
Offline
最后一次露面:2年5个月前
加入:2017-03-29 10:50
亲爱的Dialog_Support,

亲爱的Dialog_Support,

感谢你的回复。

1) I understand this point. I have implemented this in my application code. I want my device to do advertising even when it is in sleep mode. So its successfully implemented.

2)我已经实现了与BLE_APP_SLEEPMODE示例相同的外部中断。但在我的自定义应用程序中,使用单个按钮实现了3个不同的功能。例如,如果按下按钮3次,那么功能'a'将运行,如果按钮长按3秒钟,那么功能'b'将运行,如果按下按钮5次,那么功能'c'将跑步。但是,我只能生成外部中断唤醒,只有我为3个功能编写了代码而仅为一个功能唤醒。你能帮我帮忙吗?你能更重要地解释我,了解极性和脱嘴如何影响睡眠和唤醒功能。

3) Yes i have used these 2 functions arch_disable_sleep() and arch_set_extended_sleep() to wake up the device and to put the device is in sleep mode.

Thank you again for your helpful reply. I am facing one issue. Whenever mobile application tries to connect to device(when device is in sleep mode and its advertising), device is not getting connected smoothly, means its taking long time to connect and sometimes it shows message like connection fail, disconnected. I mean its not working smoothly in sleep mode as it was working smoothly in active mode. What could be the reason for that? I have also configured that, whenever app connects to the device, device should wake up from sleep and then go back to sleep whenever device disconnects from app.

With Regards,
Ruchi Patel.

mt_dialog.
Offline
最后一次露面:1 month 3 weeks ago
Staff
加入:2015-06-08 11:34
嗨Ruchi Patel,

嗨Ruchi Patel,

关于第二个问题,对不起,我无法理解这个问题,是的,你可以实现一个函数,你可以在哪里跟踪按下按钮的时间,但从上一个帖子我明白设备无法唤醒。设备无法唤醒通过来自SESNor的中断,所以我可以假设的是,也许这与唤醒定时器必须跟踪或由于唤醒定时器实现的替代功能的特征有关。您将能够在UM-B-051 DA1458X软件平台refence.pdf中找到有关这些设置的更多信息,请参见第10.7段唤醒定时器。

There is no difference between the sleep mode and always active mode regarding the connection procedure of a device, i mean that the central will be waiting for an advertising event in order to start the connection procedure, and the device, either when sleeping or when its not, will advertise in fixed connection intervals, what can delay the connection procedure is the fact that the advertising interval is large and this is irrellevant with the sleeping mode. I would recommend to run some dialog examples in sleep mode and then try again without the sleep mode, and check if you can replicate your issue having those examples as reference.

谢谢mt_dialog.

Ruchi Patel.
Offline
最后一次露面:2年5个月前
加入:2017-03-29 10:50
亲爱的Dialog_Support,

亲爱的Dialog_Support,

谢谢你的不断支持。现在我能够使用传感器中断唤醒睡眠状态。配置扩展睡眠模式后,我注意到我的自定义应用程序在之前的情况下不顺利工作。我面临的问题是,
1.智能手机的应用程序无法轻松连接电路板(开发套件或定制板)。它显示了“连接”,“连接失败”,“断开连接”的状态。
2.使用自定义应用程序有一个按钮。而且我已配置为我按下按钮,设备应该从睡眠中唤醒。但是在按下按钮后有时,设备不会醒来。

With Regards,
Ruchi Patel.

mt_dialog.
Offline
最后一次露面:1 month 3 weeks ago
Staff
加入:2015-06-08 11:34
嗨Ruchi Patel,

嗨Ruchi Patel,

由于您之前的问题已得到解答,请不要在无关的论坛主题中发布其他问题,您可以随时为您的问题创建一个新主题。

  1. 难以连接的事实可能与许多因素有关,以及您的描述,我无法确定可能是问题。关于外围侧的连接过程大多数与广告相关,如果设备是广告,并且中央能够看到设备需要两个广告事件,以便连接过程启动。什么可以减慢连接过程是广告间隔,设备越频率越频越多,外围设备将与中央连接的越多。同样可以与电话或手机应用程序本身相关,并且在任何情况下都没有使您实现外部唤醒或通过计时器唤醒。
  2. 关于您的第二个问题,您必须调试这一点以弄清楚为什么会发生这种情况,检查中断是否每次按下按钮时会发生中断,可能对您的代码有一个条件,以防止启动通告命令发送到堆栈,如果未发生中断,请检查唤醒定时器是否始终正确配置(相同的极性和衰弱配置),如果发生在您的自定义板上可能与HW相关。

谢谢mt_dialog.