about sleep and the external interrupt.

11 posts / 0 new
Last post
liyang
Offline
Last seen:5 months 3 weeks ago
Expert
加入:2014-09-24 11:51
about sleep and the external interrupt.

Hi,Dialog:

We know,when the DA prepare to go into sleep ,it will close the power of the Peripheral ,So when it in sleep . Can the external interrupt work ?

Thanks liyang

Device:
summer20100514
Offline
Last seen:4 years 4 months ago
Guru
加入:2014-12-30 05:01
Of course it will work well.

Of course it will work well. There are lots of posts discussing external interrupt, maybe you should read these first.

MT_dialog
Offline
Last seen:2 months 6 days ago
工作人员
加入:2015-06-08 11:34
Hi liyang,

Hi liyang,

Please, except from the posts in the forum please have a look at the document UM-B-004 Peripheral Drivers and UM-B-006 Sleep mode configuration.

Thanks MT_dialog

liyang
Offline
Last seen:5 months 3 weeks ago
Expert
加入:2014-09-24 11:51
Hi,Dialog:

Hi,Dialog:

Well,I have read the the document UM-B-004 Peripheral Drivers and UM-B-006 Sleep mode configuration. I always have some questions.
Could I send a message in the GPIO2_Handler() (my test prove it work) ? And if I can , when could the message be send ? The UM-B-006
外部中断是一个中说ronous events, it can not make the BLE Core active. Wait for a synchronous event come?

Thanks liyang

MT_dialog
Offline
Last seen:2 months 6 days ago
工作人员
加入:2015-06-08 11:34
Hi liyang,

Hi liyang,

You can send a message from the ISR to the kernel, with the ke_msg_send_basic() function to your TASK_APP (check the SmartTag Reference design sending a message through the interrupt handler). The document explains that if there is an external interrupt most probably the BLE core would be sleeping, thats why is called an asynchronous interrupt. If there is an asynchronous interrupt you can wake up the BLE core.

Thanks MT_dialog

liyang
Offline
Last seen:5 months 3 weeks ago
Expert
加入:2014-09-24 11:51
Hi,Dialog:

Hi,Dialog:

If there is an asynchronous interrupt how to wake up the BLE core ?

Thanks liyang

MT_dialog
Offline
Last seen:2 months 6 days ago
工作人员
加入:2015-06-08 11:34
Hi liyang,

Hi liyang,

Please check the SmartTag code in the app_button_press_cb() function, the software gets an external button interrupt wakes up the BLE and sends a message.

Thanks MT_dialog

liyang
Offline
Last seen:5 months 3 weeks ago
Expert
加入:2014-09-24 11:51
Hi,Dialog,

Hi,Dialog,
Like this?

if (app_ble_ext_wakeup_get())
{
//Wakeup BLE here

#if (EXT_SLEEP_ENABLED)
app_set_extended_sleep();
#elif (DEEP_SLEEP_ENABLED)
app_set_deep_sleep();
#else
app_disable_sleep();
#endif
SetBits32(GP_CONTROL_REG, BLE_WAKEUP_REQ, 1);
app_ble_ext_wakeup_off();
ke_msg_send_basic(APP_WAKEUP_MSG, TASK_APP, NULL);
}
app_button_enable();

question: 1 what do it mean if the function app_ble_ext_wakeup_get() returns false?
2 is this is wake up the BLE ? SetBits32(GP_CONTROL_REG, BLE_WAKEUP_REQ, 1);
3 why I need to call this function ? app_ble_ext_wakeup_off();

Thanks liyang.

MT_dialog
Offline
Last seen:2 months 6 days ago
工作人员
加入:2015-06-08 11:34
Hi liyang,

Hi liyang,

The app_ble_ext_wakeup_get() checks if the BLE core is in permanent sleep or not..... You can find what BLE_WAKEUP_REQ does in the datasheet. Also you can find why you need to call app_ble_ext_wakeup_off() in the document UM-B-006.

Thanks MT_dialog

liyang
Offline
Last seen:5 months 3 weeks ago
Expert
加入:2014-09-24 11:51
Hi,Dialog:

Hi,Dialog:

In the function app_ble_ext_wakeup_off(),only a flag ----sleep_ext_force is was assigned . And the brief of the function is Puts the BLE core to permanent sleep.
Can it work ? why?

Thanks liyang

MT_dialog
Offline
Last seen:2 months 6 days ago
工作人员
加入:2015-06-08 11:34
Hi liyang,

Hi liyang,

What the function app_ble_ext_wakeup_off() does is to disable the feature that the da is going to wake up only from external interrupt. The document UM-B-006 instructs that if you are woken from an external interrupt only (you had set the app_ble_ext_wakeup_on()) and you want to wake up the BLE then the you must restore the default mode of operation by calling app_ble_ext_wakeup_off() or the BLE won't be able to wake up in order to serve BLE events.

Thanks MT_dialog