4 posts / 0 new
Last post
sklin
Offline
Last seen:5 years 8 months ago
Expert
Joined:2014-08-12 08:01
Wake up BLE core

Hi Dialog
It's said that BLE core always wake up by asynchronous events like advertising/connetion event.
How can I wake up the BLE core immediately but not waitting for the asynchronous events.

Joacimwe
Offline
Last seen:1 year 4 months ago
Guru
Joined:2014-01-1406:45
try this:

try this:

if (GetBits16(CLK_RADIO_REG, BLE_ENABLE) == 0) { // BLE clock is off
SetBits16(GP_CONTROL_REG, BLE_WAKEUP_REQ, 1);
}

sklin
Offline
Last seen:5 years 8 months ago
Expert
Joined:2014-08-12 08:01
Hi Joacimwe

Hi Joacimwe
Thank you very much.
I hope to get a button press event.so I enabled the Wakeup Timer.and I configure the GPIO like below:
void GPIO_reservations(void)
{
...
RESERVE_GPIO( PUSH_BUTTON,GPIO_PORT_1,GPIO_PIN_3,PID_GPIO);
}
void set_pad_functions(void)
{
...
GPIO_ConfigurePin( GPIO_PORT_1,GPIO_PIN_3,INPUT_PULLUP,PID_GPIO,false);
}
then I call this function:
void app_button_enable(void)
{
wkupct_register_callback(app_button_press_cb);
if(GPIO_GetPinStatus( GPIO_PORT_1,GPIO_PIN_3))
wkupct_enable_irq(0x800, 0x800,1, 0);
}
and I rewrite theapp_button_press_cbfucntion like below:
void app_button_press_cb(void)
{
if (GetBits16(CLK_RADIO_REG, BLE_ENABLE) == 0) // BLE clock is off
{
SetBits16(GP_CONTROL_REG, BLE_WAKEUP_REQ, 1);
}
app_button_enable();
ke_msg_send_basic(APP_WAKEUP_MSG,TASK_APP,NULL);
}
Well ,now I can go into the app_button_press_cb fucntion when a external interrupt occur.
But I still can't receive theAPP_WAKEUP_MSGevent in TASK_APP.
Note:I have define sleep mode like below
#define CFG_EXT_SLEEP
#undef CFG_DEEP_SLEEP

Can you help me?

WT_Dialog (not verified)
Hi Sklin,

Hi Sklin,

我很惊讶你代码不工作。

What if you try to reserve the below two lines?

app_button_enable();

ke_msg_send_basic(APP_WAKEUP_MSG,TASK_APP,NULL);

If this still does not work, I would add a while loop belowSetBits16(GP_CONTROL_REG, BLE_WAKEUP_REQ, 1) to make sureGetBits16(CLK_RADIO_REG, BLE_ENABLE) returns 1.