DA14580 Ready to receive UART after Wake Up

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.xmece.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
8 posts / 0 new
Last post
Avouaill
Offline
Last seen:3 years 8 months ago
加入:2016-09-19 15:21
DA14580 Ready to receive UART after Wake Up

Hi,

I trigger on an interrupt to wake up the DA14580.
What i would like to know is when is it ready to receive UART informations and send them. Will it be at the end of the callback function or further on the code ?
Thanks in advance.

Device:
MT_dialog
Offline
Last seen:2 months 3 weeks ago
工作人员
加入:2015-06-08 11:34
Hi Avouaill,

Hi Avouaill,

When in sleep mode the device shuts down the XTAL16 which is crucial for the clock generation off the UART, so after waking up you will have to wait in order for the XTAL16 to settle. The safest place that assures that the XTAL16 has settled is in the app_on_ble_powered callback (since the core also requires the XTAL16 in order to operate), after going through that function and as long as you dont go to sleep the device will have the XTAL16 settled and ready and you will be able to receive data via UART.

Thanks MT_dialog

Avouaill
Offline
Last seen:3 years 8 months ago
加入:2016-09-19 15:21
Hi,

Hi,

Thanks for your answer.
I actually use the version V.150.2, and i can't find any app_on_ble_powered function. Do you know if there is an equivalent in the version i use.

Thanks in advance

问候

MT_dialog
Offline
Last seen:2 months 3 weeks ago
工作人员
加入:2015-06-08 11:34
Hi Avouaill,

Hi Avouaill,

In all SDK5 versions the callback is named app_on_ble_powered, even in the SDK5.0.2.1 which is the first SDK 5 release, i suppose that you are using SDK3. In that case there are no callbacks that you can attach your source code and the related hook that you can place the code is the app_asynch_trm() function. But i would strongly suggest to move to SDK 5.

Thanks MT_dialog

Avouaill
Offline
Last seen:3 years 8 months ago
加入:2016-09-19 15:21
Hi,

Hi,

Ok i got it.
What i try to do is wake up the BLE module from extended sleep mode and send an interruption to the uC to warn when the UART is ready.
Is it possible to provide me with a callback function which could wake up properly the BLE module all the necessary functions ? I will add the interruption to match with my requirements afterwards.

问候

Avouaill
Offline
Last seen:3 years 8 months ago
加入:2016-09-19 15:21
Hi,

Hi,

Nearly done, the callbcack function is called properly and i toggle BLE_int inside to generate the interruption on the uC.
The problem is that after exactly 3 wake up, for no reason it doesn't toggle BLE_int anymore.
Here is the code of my callback function :

void ext_wakeup_cb(void)
{
if ( fsleep == ARCH_EXT_SLEEP_ON)
{
if (GetBits16(SYS_STAT_REG, PER_IS_DOWN))
{

if (DEVELOPMENT_DEBUG){
GPIO_reservations();
}
}

SetBits32(GP_CONTROL_REG, BLE_WAKEUP_REQ, 1);
fsleep = ARCH_SLEEP_OFF;
}
else
fsleep = ARCH_EXT_SLEEP_ON;

GPIO_SetActive(GPIO_PORT_0,GPIO_PIN_7); //Signal to uC to warn UART is ready
wkupct_enable_irq(0x40, 0x00, 1,0);
wkupct_register_callback(ext_wakeup_cb);
GPIO_SetInactive(GPIO_PORT_0,GPIO_PIN_7); //Signal to uC to warn UART is ready
}

There must be something wrong in my function that i don't see.

Thanks in advance

MT_dialog
Offline
Last seen:2 months 3 weeks ago
工作人员
加入:2015-06-08 11:34
Hi Avouaill,

Hi Avouaill,

I am not sure if that is what you are looking for, but in order to force the wake up of the BLE (no pending event scheduled so the application will have to force the BLE to wake up) you will have to invoke the arch_ble_force_wakeup(); after doing that the device should start the waking up procedure of the Core and as soon as the core has awaken the app_asynch_trm() will get executed.

Regarding the issue that you mention on the later post, i suppose that you dont see the GPIO toggling as you would expect, well i dont see anywhere in the callback function to invoke the periph_init() function in order for your pins to be initialized, so perhaps the times that the device is toggling the pin it just happens that the device and the peripherals to be awake. A few comments as well, there is no need to invoke the GPIO_reservations(), the function its invoked once during system initialization, there is no need to invoke it again. Instead of enabling the ble core by directly writting on the register you can use the arch_ble_force_wakeup() function, if i remember correctly there is the app_ble_force_wakeup() on SDK 3 which does exactly the same. Also allow me to mention again that the fact that you are making a request for waking up the BLE core doesn't mean that the Core wakes up instantly, the core will be awake as soon as the device enters the app_asynch_trm() as i have previously mentioned. Please check the ble_app_sleepmode example in the SDK5 it may be a bit different SDK but the wake up sequence followed its quite similar between the SDK's. And i insist moving in the latest SDK.

Thanks MT_dialog

Avouaill
Offline
Last seen:3 years 8 months ago
加入:2016-09-19 15:21
Hi,

Hi,

Thanks really much for your help.
I will move to the latest SDK and manage to make everything work with your tips.
The subject can be closed.

问候

Aurelien