Processor not waking up from sleep when running from RAM

⚠️
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 https://www.dialog-semiconductor.com/support . We’ll be fixing bugs / optimising the searching and tagging over the coming days.
8 posts / 0 new
Last post
AA_38901301
Offline
Last seen: 1 year 5 months ago
Joined: 2020-04-29 16:49
Processor not waking up from sleep when running from RAM

Hi,

I am using DA14531 processor in the custom board I have built. My application code works fine when debugging using JTAG: board goes to sleep and wakes up from sleep (using GPIO interrupt) perfectly! But when running from RAM, without JTAG, the board does not wake-up from sleep using GPIO interrupt (It stays in sleep once it enters sleep mode). BLE advertisement is working fine and I can make connection to the board. Has anyone faced a similar issue before? I am new to Dialog processors.

Any guidance would be much appreciated!

Thanks in advance, AA

Device: 
PM_Dialog
Offline
Last seen: 6 months 3 weeks ago
Staff
Joined: 2018-02-08 11:03
Hi There,

Hi There,

Thanks for your question online. Can you please indicate which SDK project you are using in order to test it? What is the Low Power Clock in your setup? The internal RCX, or an external XTAL32K ?

Additionally, which pin is configured as a wake-up source in the WKUP controller and what is the sleep mode that you are using?

Since you are new with our BLE products, I would recommend also checking the following tutorials :

http://lpccs-docs.dialog-semiconductor.com/DA14531_Sleep_Mode+/index.html
http://lpccs-docs.dialog-semiconductor.com/Tutorial_SDK6/index.html

Thanks, PM_Dialog

AA_38901301
Offline
Last seen: 1 year 5 months ago
Joined: 2020-04-29 16:49
Hi, Thanks for the response.

Hi, Thanks for the response. PFB details:

SDK Version                          :    6.0.12.1020
Low Power Clock                  :    LP_CLK_RCX20
Sleep Mode                            :   ARCH_EXT_SLEEP_ON        
Below 3 pins are configured as wakeup source:
[GPIO_PORT_0, GPIO_PIN_0]
[GPIO_PORT_0, GPIO_PIN_1]
[GPIO_PORT_0, GPIO_PIN_3]

Thanks, AA

PM_Dialog
Offline
Last seen: 6 months 3 weeks ago
Staff
Joined: 2018-02-08 11:03
Hi There,

Hi There,

I would strongly recommend using the latest SDK for DA4531 product family, which is version 6.0.14.1114. You can find it in the DA14531 support website.

My suggestion would be to use the ble_app_sleepmode examples of the SDK.

Location : .0.14.1114\projects\target_apps\ble_examples\ble_app_sleepmode

When the device boots, it will start advertising for a pre-defined amount of time (APP_ADV_DATA_UPDATE_TO). Then, the advertising is stopped and it will go into permanent sleep mode, so it can wake-up via a GPIO interrupt in the WKUP controller.

As mentioned, this example is using the Wake-up controller to wake up the device. Please check the app_button_enable(). The chip will wake0up with a LOW polarity interrupt (high to low) on  GPIO_BUTTON_PORT /_PIN (P0_11).

Please check the code accordingly and avoid using the P0_0 as it is the reset pin by default.

Thanks, PM_Dialog

AA_38901301
Offline
Last seen: 1 year 5 months ago
Joined: 2020-04-29 16:49
Hi,

Hi,

Thanks for the response. I have gone through the example projects. My usecase is slightly different: During inactivity (when the ADC shows flat data), I want to put the processor into extended sleep mode by keeping the BLE core active. Then, use a GPIO interrupt to wakeup the prcoessor from extended sleep. In the implementation, the main loop returns GOTO_SLEEP when the process is inactive (when the ADC shows flat data) for sometime. Then the callback function registered in WKUPCT driver is responsible for changing the return to KEEP_POWERED such that it can wakeup the processor from extended sleep. As I described in the initial post, it works fine when when debugging using JTAG. When running from RAM, it goes to sleep and the wakeup interrupt is not getting triggered once it enteres sleep.

Let me know if additional details are required for helping me out!

Thanks in advance!

PM_Dialog
Offline
Last seen: 6 months 3 weeks ago
Staff
Joined: 2018-02-08 11:03
Hi There,

Hi There,

>>> want to put the processor into extended sleep mode by keeping the BLE core active.

Can you please clarify this statement? So, do you need to put the device into sleep mode and keep advertising? If app_default_sleep_mode is set to ARCH_EXT_SLEEP_ON in user_config.h file, then the device will go to sleep mode between advertising intervals and will wake-up automatically via the BLE timer.

If the debugger is attached, this prevents the system to sleep.

Does the device stop advertising and sleep permanently?

Where and how the WKUP controller is configured?  

Can you replicate this if the device boots from SPI Flash?

Thanks, PM_Dialog

AA_38901301
Offline
Last seen: 1 year 5 months ago
Joined: 2020-04-29 16:49
Hi,

Hi,

Please find below answers:

>>>>> Can you please clarify this statement? So, do you need to put the device into sleep mode and keep advertising? If app_default_sleep_mode is set to ARCH_EXT_SLEEP_ON in user_config.h file, then the device will go to sleep mode between advertising intervals and will wake-up automatically via the BLE timer.

- Yes, I want to put the device into sleep mode and keeep advertising (Let the BLE timer wakes-up the device automatically for advertising) That is why I chose ARCH_EXT_SLEEP_ON setting but the application code decides when to put the device into sleep mode. Also the application wants to wakeup the processor from extended sleep using GPIO interrupt.

>>>>>> Does the device stop advertising and sleep permanently?

 - No, it does not stop advertising (that confirms the BLE timer is able to wake-up the device periodically) but the GPIO interrupt is not getting triggered and hence the application is not able to change the main loop retrun from GOTO_SLEEP to KEEP_POWERED. 

>>>> Where and how the WKUP controller is configured?  

- The application detects inactivity for 5 seconds and then returns GOTO_SLEEP from main loop. Before this, it configures the WKUP controller such that the GPIO interrupt can wake the device up on activity. If an interrupt is triggered it changes main loop return to KEP_POWERED so that the processor can wake-up.

/* callback function (Registered in WKUPCT driver) */
static void app_on_wakeup_cb(void)
{
    wkupct_disable_irq();
    sleep_interrupted = true;
}

/* Sets SW1 as wakeup trigger. This function gets called when the application has been idle for 5 secs. */
void sc_int_config_irq(void)
{
    wkupct_disable_irq();
            
    wkupct_register_callback(app_on_wakeup_cb);
    wkupct_enable_irq(WKUPCT_PIN_SELECT(SW_1_PORT, SW_1_PIN), 
                                        WKUPCT_PIN_POLARITY(SW_1_PORT, SW_1_PIN, WKUPCT_PIN_POLARITY_HIGH), 
                                        1,
                                       10);
}

>>> Can you replicate this if the device boots from SPI Flash?

 - I haven't tried it yet.

The reason why I wanted to put the device into sleep and wake it up this way is because, I want to turn OFF peripherals like ADC & LED during inactivity and turn them back ON during activity. 

Let me know if there are further questions. Thanks.

PM_Dialog
Offline
Last seen: 6 months 3 weeks ago
Staff
Joined: 2018-02-08 11:03
Hi There,

Hi There,

If the ARCH_EXT_SLEEP_ON is defined, then the device will go to sleep between adverting or connection intervals.

>>The application detects inactivity for 5 seconds and then returns GOTO_SLEEP from main loop.

Can you please clarify this statement? What are the modifications you have done?

>> If an interrupt is triggered it changes main loop return to KEP_POWERED so that the processor can wake-up.

Do you mean in the main() function in arch_main() ?If yes, this is an SDK modification and we strongly recommend not modifying the SDK. All the development should be in the application layer ( all the files that start with app_ )

>>>The reason why I wanted to put the device into sleep and wake it up this way is because I want to turn OFF peripherals like ADC & LED during inactivity and turn them back ON during activity.

When the device is sleeping, all the peripheral domains are powered down. All of them are powered-on, when it is in active mode.

Thanks, PM_Dialog