我怎么能知道DA14580'OS是准备好了吗?

5 posts / 0 new
Last post
liyang
Offline
Last seen:5 months 3 weeks ago
Expert
Joined:2014-09-24 11:51
我怎么能知道DA14580'OS是准备好了吗?

hi,Dialog:

you see , I cann't use the app_timer_set() and the send message function(eg: ke_msg_send_basic()) before the os is ready.

but how can I know the Os is just ready ?

Thanks liyang.

Device:
MT_dialog
Offline
Last seen:2 months 1 week ago
Staff
Joined:2015-06-08 11:34
Hi liyang,

Hi liyang,

I am not sure i undestand, you can't send a basic message through a kernel_timer because the OS is not ready ? The OS is always ready since the ble is on. If you set your timer when the BLE is on then the message you send from your timer is going to be served. Perhaps you set the timer when the BLE isn't on and the timer never occurs ?

Can you please check this FAQ maybe it will help youhttp://support.dialog-semiconductor.com/faq/how-use-ketimer-during-wakeu...

Thanks MT_dialog

liyang
Offline
Last seen:5 months 3 weeks ago
Expert
Joined:2014-09-24 11:51
Hi, MT_dialog,

Hi, MT_dialog,

You are right, The OS is always ready since the ble is on. and then I can use the timer.
As usual ,when the DA reboot ,before the ble is on ,if I use the timer or send the message ,the timer will never occurs , it has no effect .
But my condition is special. when the DA reboot ,before the ble is on ,the GPIO2 external interrupt comes ,in the GPIO2_Handler() I send a message then the program break.
The program as follow:

void GPIO2_Handler(void)
{
NVIC_DisableIRQ(GPIO2_IRQn); /* ① close the interrupt */

/*
* peripheral domain si down, then this is wakeup procedure. need to call periph_init().
*/
Gbext2IrqIsComeFlg = true; /* 防重入开始 ly150925 */
if (GetBits16(SYS_STAT_REG, PER_IS_DOWN))
periph_init();
Gbext2IrqIsComeFlg = false; /* 防重入结束 ly150925 */

GLOBAL_INT_STOP();
/*
* 将FIFO中数据先取出
*/
adxl362FifoRead(adxl362DataBuf, FIFO_NUM_SET * 6); /* ② clear the 362 IRQ Pin */
GLOBAL_INT_START();

#if (CFG_LED_CTL)
if (LED_UNACTIVE == __tGledCtlHandler.eLedActive) {
setSleepOn();
}
#endif //CFG_LED_CTL

//Wakeup BLE here
SetBits32(GP_CONTROL_REG, BLE_WAKEUP_REQ, 1); //the BLE wake up
app_ble_ext_wakeup_off();

ke_msg_send_basic(ADXL362_WAKEUP_MSG, TASK_APP, TASK_APP);

SetWord16(GPIO_RESET_IRQ_REG, 1 << (GPIO2_IRQn-GPIO0_IRQn)); /* ③ clear the MCU IRQ Pin */

NVIC_EnableIRQ(GPIO2_IRQn); /* ④ open the interrupt */
}

the program will break. Is it true ?

Thanks liyang.

MT_dialog
Offline
Last seen:2 months 1 week ago
Staff
Joined:2015-06-08 11:34
Hi liyang,

Hi liyang,

In your interrupt handler you wake up the ble core and then you send the message. Normally the message should be in the queue and the OS is going to serve it as soon as it is ready. If you are facing any probelms, maybe is because of the interrupt routine and the INT_START/STOP that you invoke. It might be better if you set a flag in your ISR and handle the interrupt event in the app_async_trm function.

Thanks MT_dialog

liyang
Offline
Last seen:5 months 3 weeks ago
Expert
Joined:2014-09-24 11:51
Hi, MT_dialog,

Hi, MT_dialog,

OK, Thanks for your help.

Thanks liyang.

Topic locked