DSPS time need to awake from edge interrupt.

5 posts / 0 new
Last post
joanquark
Offline
Last seen:4 years 10 months ago
加入:2015-06-01 08:59
DSPS time need to awake from edge interrupt.

Hi

i've my custom DSPS where i use a P06 as input interrupt, in a way that the master cpu generates a falling edge and sends to the DA14580 over UART, new string which is updated to advertising at rising edge , all work properly in debug mode , but once i compile the application with default_sleep mode= EXT_SLEEP, i need to put a breakpoint on the Master CPU between falling edge and data transmitt, in order the DA14580 to pick properly the data, that rings a bell that time need to awake DA14580 is not small....
the master cpu is carrying a 5ms delay from falling edge till beginning transmitting data (which should be enough), but it still does not work, the question is, which is the time need for arch_disable_sleep(); on the falling edge of DA14580 in order to be ready to receive UART data?

//-------------------- this is the code of the interrupt ---------------------
void gpioctrl_callback(void)
{
NVIC_DisableIRQ(GPIO0_IRQn); // Disable this interrupt
if (GPIO_GetPinStatus(GPIO_PORT_0, GPIO_CTRL) == false){
// falling edge
AdvLen=0;
if (app_default_sleep_mode == ARCH_EXT_SLEEP_ON)
arch_disable_sleep(); // arch_force_active_mode();
// set interrupt to detect rising edge of GPIO_CTRL
GPIO_EnableIRQ(GPIO_PORT_0, GPIO_CTRL, GPIO0_IRQn, 0, 1, 0);
}else{
/ /前沿,选择新的advertising data and publish it.
if (SpsState==0){
if (AdvLen){
if (BuffAdv[0]=='F' && BuffAdv[1]=='L'){
FlightMode=1;
app_easy_gap_advertise_stop();
AdvLen=0;
}else{
// #DL16 try change advertising message .
if (FlightMode>=1){
FlightMode=0;
app_easy_gap_undirected_advertise_start();
}else{
app_easy_gap_advertise_stop();
}
}
}
if (app_default_sleep_mode == ARCH_EXT_SLEEP_ON)
arch_set_extended_sleep();
}
uart_txdata_setf(0x06); // Echo ACK
//AdvLen=0;
//Set interrupt to detect falling of P06
GPIO_EnableIRQ(GPIO_PORT_0, GPIO_CTRL, GPIO0_IRQn, 1, 0, 0);
}
NVIC_ClearPendingIRQ(GPIO0_IRQn);
NVIC_EnableIRQ(GPIO0_IRQn); // Enable this interrupt
}

问候

Device:
joanquark
Offline
Last seen:4 years 10 months ago
加入:2015-06-01 08:59
Please Dialog MT, any help in

Please Dialog MT, any help in this issue?

问候

MT_dialog
Offline
Last seen:2 months 3 days ago
Staff
加入:2015-06-08 11:34
Hi joanquark,

Hi joanquark,

When the device wakes up, it goes through the LP and the SLP handler, while you are in the LP handler you wont be able to use the UART since the calibrating value is applied to the XTAL, on the SLP on the other hand the UART is available for usage (you can also check the gtl_eif_init() and hci_eif_init() functions which are called if an external host is present in order to receive from uart) this operation takes less than 5ms, and you should be able to use the UART and get proper data after this amount of time. But all the above happens when you wake up from a programmed BLE event, when you wake up from an external event the isr that executes first, is the wakeup_handler, as far as i can see there is no invocation of the periph_init() function in order to start your peripherals and also since you dont force the BLE to wake up there is no XTAL16 switching, as far as i can tell the device goes through the SLP Handler in order to execute all the previous procedures when you invoke the start advertise command, i assume that thats the reason for being able to get proper data after setting a breakpoint to your external MCU. In your wakeup handler try to force the ble to wake up, initialize your peripherals and disable sleep afterwards.

Thanks MT_dialog

joanquark
Offline
Last seen:4 years 10 months ago
加入:2015-06-01 08:59
Hi ,

Hi ,

just putting periph_init() on the falling edge makes it work

thanks

MT_dialog
Offline
Last seen:2 months 3 days ago
Staff
加入:2015-06-08 11:34
Hi joanquark,

Hi joanquark,

Glad it did, thanks for reporting back.

Best Regards MT_dialog

Topic locked