9个帖子/ 0新
Last post
Zwang308.
Offline
Last seen:4年5个月前
Master
Joined:2014-07-02 14:15
深睡眠模式。

Hi Dialog,

I want to make DA14580 working without any sleep mode and go into deep sleep mode after an I2C event.

I did the changes list below, however it seems DA is not really get into deep sleep mode.

1.我在da15480_config.h和unwemine中定义cfg_deep_sleep

2. I comment code

#if (EXT_SLEEP_ENABLED)
app_set_extended_sleep();
#elif (DEEP_SLEEP_ENABLED)
app_set_deep_sleep();
#别的
app_disable_sleep();
#endif

in main_func to disable sleep mode before I get an I2C package.

3. I add the this code when I get the I2C package:

app_stop_adv();
app_set_deep_sleep();

I saw DA stop advertising but I didn't see the power consumption decrease. It looks like the processor is not halted, it still consume me about 800uA.

在I2C事件(任何其他事件都很好后,您可以帮助我在深度睡眠模式中帮助我吗?在此之前不使用睡眠模式,我只想强制将其设置为深度睡眠模式)。

谢谢!

TR_Dialog
Offline
Last seen:10 hours 8 min ago
Staff
Joined:2014-06-30 23:52
Hi Zeyu:

Hi Zeyu:

First please make note of the following:

When you get out of deep sleep hardware uses a dedicated hardware block to copy application code from OTP to SysRam, then it passes the control to M0 processor to run from where it left off before going to deep sleep. Therefore a clean exit from deep sleep occurs only when the application software is in OTP.

If you are using flash memory, the same above steps will occur, resulting in whatever code was in OTP (most likely all zeroes if you have never burnt it) to be copied into sysRAM. M0 will try to execute it leading to a watch dog caused reset. BootRom will fetch code from flash memory and execute it from the beginning. This process takes around 2.5 to 3 seconds.

For the scenario you have described above i recommend the following:

- 在da15480_config中定义cfg_deep_sleep.h,

- You can comment out the section in arch_main.c, but add one line at the bottom as shown below.

/ *

#if (EXT_SLEEP_ENABLED)
app_set_extended_sleep();
#elif (DEEP_SLEEP_ENABLED)
app_set_deep_sleep();
#别的
app_disable_sleep();
#endif

*/

app_disable_sleep();

Now you can have the following code at the end of your I2C transaction:

app_stop_adv();
app_set_deep_sleep();

使用上面的代码将改变go into deep sleep but will wake up every 10 seconds to take care of BLE.

如果您不希望发生这种情况,则需要使用以下代码:

app_stop_adv();
app_set_deep_sleep()

app_ble_ext_wakeup_on();
app_button_enable();

Now system will only wake up if an external interrupt occurs.

Your interrupt handler (app_button_press_cb) must have the following code:

if(getBits16(sys_stat_reg,per_is_down))
periph_init(); // re-init peripherals after exiting deep or extended sleep.

if (app_ble_ext_wakeup_get())
{
//唤醒这里的ble
app_disable_sleep();
SetBits32(GP_CONTROL_REG, BLE_WAKEUP_REQ, 1);
app_ble_ext_wakeup_off();//如果在深入睡眠之前使用app_ble_ext_wakeup_on()则使用此
}

app_button_enable();

如果您的代码现在从闪存运行,请使用app_set_extended睡眠替换对app_deep_sleep的调用。

If you are loading code from external MCU to DA14580, you have two choices:

use extended sleep only: your power consumption will go to 1.x uA.But you would not have to reload code every time you wake up

use deep sleep: You will get some addition power savings. But you will have to load firmware onto sysRAM everytime

谢谢,

TR_DIALOG

Zwang308.
Offline
Last seen:4年5个月前
Master
Joined:2014-07-02 14:15
嗨tr_dialog,

嗨tr_dialog,

Thanks a lot for your swift reply. I add app_disable_sleep(); after the comment and the application current consumption drop from 800uA to about 200uA. However I still wondering where does the 200uA come from. I tried to define DEVELOPMENT_DEBUG both 0 and 1. Also, I tried to undefine DEVELOPMENT_DEBUG. But the application still consumes 200 uA. Do you have any idea of that?

Basically, in our application, we do not care the wakeup staff because every time the system powers up, we will reload the FW into system ram through SPI bus.

谢谢!

Zwang308.
Offline
Last seen:4年5个月前
Master
Joined:2014-07-02 14:15
嗨tr_dialog,

嗨tr_dialog,

The problem is solved. Components connected to some DA pins consumes the extra current. I need to configure the PIN to certain mode before I enter deep sleep mode.

Thanks a lot for the help.

fxishui
Offline
Last seen:3 years 9 months ago
Joined:2016-04-12 13:27
有调好的睡眠睡眠子工程,可以是我一件,我!

有调好的睡眠睡眠子工程,可以是我一件,我!476369963@qq.com

RandyYu
Offline
Last seen:2年10个月前
Joined:2015-01-28 08:49
if I want wake up it by ke

if I want wake up it by ke_timer,how can I modifiy it.
thank you

MT_dialog
Offline
Last seen:2个月2周前
Staff
Joined:2015-06-08 11:34
嗨兰迪宇,

嗨兰迪宇,

Yes you can, just set up a kernel timer before fallingpermanently tosleep . For example if you want to advertise fall to sleep permanently and then start advertise again, you can stop advertising by invoking advertise_stop() and in the advertising stop callback set up a kernel timer. In the callback of the kernel timer you can invoke the advertise_start() in order to start advertise again.

Thanks MT_dialog

RandyYu
Offline
Last seen:2年10个月前
Joined:2015-01-28 08:49
which function is the

which function is the callback of the kernel timer ?

MT_dialog
Offline
Last seen:2个月2周前
Staff
Joined:2015-06-08 11:34
嗨兰迪宇,

嗨兰迪宇,

The declaration of the callback of each timer is a custom function that you insert as input when you start a timer. In case of the easy_timer api (on SDK 5) an examples would be app_easy_timer(time_you_need, callback_that_should_be_called_when_time_elapse). In case of the SDK you will have to declare the message and the callback in the app_task_handlers.h file like all the callbacks that are located in that file and in order to start the timer you need to invoke the app_timer_set() function.

Thanks MT_dialog