GPIO Button handling functionalities while in sleep mode

Hi Team,

I am using da14531mod, When i am pressing the button to poll short press and long press it is working in debug mode.

The same program has been flashed in SPI and called the power management call to ARCH_EXT_SLEEP_ON. then it is not working with my key functionalities.

It means after some time the device goes to extended sleep mode and there is no control to retrieve the gpio information because all the peripherals like timer, gpio etc are going into sleep mode.

Please help me find my external button key short and long press information.

Regards,

Lofna

  • Hi Lofna, 

    This is the expected behaviour because when the debugger is attached the chip is not sleeping. When the debugger is de-attached or the device boots from flash, it goes into extended sleep mode. Keep in mind that the chip is going into extended sleep mode between intervals ( advertising or connection) and wake up automatically via the BLE timer. 

    If you would like to detect a GPIO interrupt during extended sleep mode, the wake-up controller should be configured. 

    So, this sound like the wake-up controller is not configured properly. Please double-check that it is configured correctly. 

    The ble_app_sleepmode example can be a reference. 

    Best regards, 

    PM_Renesas

  • Hi Team,
    Thanks for your response.
    I run the program and getting the button interrupt is fine as per ble_app_sleepmode  example. But my case is here broadcasting the ibeacon information for ever. when i press any button i am sending the press and unpress signal over beacon and the below function 
    (void)spi_flash_power_down(); is not defined anywhere in the ble_app_sleepmode example code?
    And as per this code concern they are calling the below statement in their example.
    static const sleep_state_t app_default_sleep_mode = ARCH_EXT_SLEEP_OTP_COPY_ON;
    How can i define as per my code should i define the same as above? or below:
    static const sleep_state_t app_default_sleep_mode = ARCH_EXT_SLEEP_ON;
    Regards,
    Lofna
  • Hi Lofna, 

    How do you detect the button press and unpress since you are using extended sleep mode? 

    As mentioned, the wake-up controller should be used to detect a GPIO interrupt in extended sleep mode. 

    Regards, 

    PM_Renesas

  • Hi Team,

    Thanks for your reply.

    I took the blinky example from your SDK i.e

    SDK_6.0.16.1144\DA145xx_SDK\6.0.16.1144\projects\target_apps\peripheral_examples\blinky\Keil_5\blinky

    which is long press and short press based on SWITCH it will blink the LEDs.

    I took the example and implemented it for our SoS application. The button is nothing but SoS when somebody pressed, then it should send the pressing signal (button press '1' and unpress '0') over the beacon.

    This logic absolutely working in Debug (RAM) mode when i call : static const sleep_state_t app_default_sleep_mode = ARCH_EXT_SLEEP_ON;

    But this is not working while the program is written into the SPI flash. I know the peripherals are shutoff.

    For me it is taking more time to sync the code with wakeup controller, Please somebody can help me to add the wake controller in the attached source and let me know with the same functionalities.

    Rgds,
    Lofna

  • Hi Team,

    Please let us know your suggestion and solution on the below mail.

    rgds,

    Lofna

  • Hi Team,

    As per my requirement should i call the extended sleep mode for our sos beacon application?

    I tried the example code of blue _app_ sleepmode. When the switch is pressed it should appear the ble node in our mobile and after some time the device goes to sleep mode.

    But my requirement is to broadcast a beacon in forever which is in timer call. due to extended sleep timer also will not work or what?

    Please help me to overcome this issue. Is it possible or not?

    rgds,

    lofna 

  • Hi Team,

    I am very nervous because of your response. 

    If there is any difficulty, don't call this function : static const sleep_state_t app_default_sleep_mode = ARCH_EXT_SLEEP_ON; Is there any way to optimize the power consumption?

    It seems this is not user friendly?

    Regards,

    Lofna

  • Hi Iofna, 

    Apologies for the delay. 

    By doing this 

    static const sleep_state_t app_default_sleep_mode = ARCH_EXT_SLEEP_ON;

    The device will enter extended sleep mode.

    This means that the chip will go into extended sleep mode between non-connectable advertising  intervals (beacon app) and will wake up automatically via the BLE Timer. 

    During sleep, all the peripheral blocks are OFF. 

    The intervals are configurable : 

    Larger adverting intervals mean that the device is sleeping more time and as a result less average current consumption!

    If you would like NOT to stop advertising you can increase the intervals.

    Please check user_adv_conf in user_config.h file. 

        /// Minimum interval for advertising - set in user_app.c
        .intv_min = MS_TO_BLESLOTS(0),                    
    
        /// Maximum interval for advertising - set in user_app.c
        .intv_max = MS_TO_BLESLOTS(0),

    If your project does not require advertising all the time, you can stop advertising and configure the device into sleep mode ( extended. deep or hibernation depending on your requirements) 

    With regards to the ble_app_sleep mode, the project implements and app_easy_timer to STOP advertising. As soon as the advertising has been stopped, the device is configured into sleep mode ( no BLE activity). It can be woken up via an external interrupt on the WKUP controller. 

    If you need to advertise beacon all the time, please remove the aforementioned timer. 

    Best regards, 

    PM_Renesas

  • Hi Renesas,
    Thanks for your quick response.
    My application is to transmit the beacons and that will integrate our beacons to  Gateway. It is completely location tracking (asset tracking) purpose
    I will not stop my advertisements, it will broadcast forever until the battery is drained. My battery life should be min 1 year and max 3 years.
    And my advertising interval will be based on User GATT service configuration between 100ms - 1sec interval. 
    Sorry, for taking your above suggestion will not be helpful for our application. 
    Please let me know how I can handle this area. Is there any problem with handling this area while
    somebody presses the button? 
    In the market many people are implementing their SoS and office attendance applications using beacons with long life batteries to track the people. May be the people are using NorDic/DIALOG/Silicon Labs/TI solution i am not sure.
    Please do the needful.
    Regards,
    Lofna
  • Hi Lofna, 

    Since the device will be transmitting beacons continually ( BLE is ON all the time), the you can only use extended sleep mode. 

    In deep sleep or hibernation, the BLE core is off and so there is no BLE activity. 

    In the case of extended sleep mode, to lower down the power consumption you can do the following : 

    1. Power down the SPI flash 

    2. Play with advertising interval as mentioned in my previous response. 

    With regards to GPIO interrupt detection, the WAKEUP controller should be used. 

    As also mentioned the device is going into extended sleep mode between non-connectable advertising intervals. If you just use the GPIO IRQs and the GPIO interrupt arrives between advertising intervals ( extended sleep mode), the interrupt will be lost. So, you will need to configure the WAKEUP controller. 

    There are several examples showing how to configure the WAKEUP controller in order to detect and interrupt. 

    Please check ble_app_sleepmode or prox_reporter example of the SDK. 

    When someone presses a button, the wakeup controller will be triggered in order to catch the interrupt and in the callback you can add your own functionality. 

    Best regards, 

    PM_Renesas