Hi,
I m working on DA14531. How the SoC go into extended or deep sleep mode and how to set a timer to wake up it automatically.
Actually, I need that device automatically wakes up after every minute and reads data from a GPIO and then writes them to RAM and finally go back to sleep mode.
Is there any example code for this kind of scenario?
It should be mention that the device must sent the saved data to another device through BLE connection every day.
Thanks in advance
Device:
Hi harry84,
Thanks for your question online and for your interest in our TINY module BLE solution. You could take a look at the ble_app_sleepmode or prox_reporter examples of the SDK. Both are located under 6.0.14.1114\projects\target_apps\ble_examples SDK path. The ble_app_sleepmode is using a timer to stop advertising and configures the device into permanent sleep mode. It will wake up from an external interrupt trigger via the WAKEUP controller. In your case you could use the app_easy_timer() in order to wake up periodically. Upon its expiration, you should place your preferable functionality in the callback function. This can be achieved by setting the timer as shown here:
app_easy_timer(100,cb_my_timeout);
The first argument specifies the timer to time out after 100 * 10 ms = 1000ms = 1s. At this time the callback cb_my_timerout() get's called.
I would also recommend looking at theDA14531 Sleep Mode Tutorial (HTML).
The data can be stored either in the Retention-RAM or in the on-module SPI flash.
Thanks, PM_Dialog
Hi again
I tried to use app_easy_timer function to wake up the DA from extended sleep mode, but I couldn't.
could you share a sample code with me?
Thanks
Hi
Thanks for your reply
是否有样品project for storing and loading data from memory, and send them via BLE?
Hi harry84,
Could you please indicate which memory you would like to use? On-module SPI Flash, System-RAM, OTP?
Thanks, PM_Dialog
thanks for your quick reply
I would to receive the data via BLE and store them in System-RAM or vice versa, read the data from System-RAM and send them to the central
Thanks in advance.
Hi harry84,
Since you are using sleep mode in you project, I assume that you would like to you the Retention-RAM memory. Please take a look at theDA14531: Different ways of handling RESET mechanismSW Example.
This example aims to demonstrate how to store data in the unitialized section of the Retention-RAM.
Please also check global variable definitions from the SDK examples, for instance the ble_app_peripheral example.
Thanks, PM_Dialog
Hi
I tried to use app_easy_timer function to wake up the DA from extended sleep mode, but I couldn't.
could you share a sample code with me?
Thanks
Hi harry84,
Once as the device goes into sleep mode, you should configure the timer. Upon its expiration, you should place your preferable functionality in the callback function. This can be achieved by setting the timer as shown here:
app_easy_timer(100,cb_my_timeout);
The first argument specifies the timer to time out after 100 * 10 ms = 1000ms = 1s. At this time the callback cb_my_timerout() get's called.
In the callback, you should pace the code snippet from app_button_press_cb() from the ble_app_sleepmode example of the SDK.
Thanks, PM_Dialog