GPIO wake-up and sleep

Dear Dialog Support,

I am testing the example ble_app_peripheral in SDK_6.0.18.1182.1. I want to realize the following function:

Once DA14531 is powered on, it enters into the extended sleep mode. When the button is pressed down once, DA14531 wakes up and the functions of the original example ble_app_peripheral can normally perform. And when the button is pressed down once again, DA14531 enters into the extended sleep mode again, and so on.

Could you please show me how to achieve this. Thanks a lot!

  • Hi Nick,

    Thank you for posting your question online.
    Please find attached the ble_app_peripheral_wakeup.zip file. 
    I worked on SDK v6.0.18 with the DA14531MOD and the Dev Kit Pro.
    I configured the P0_11 as my button and whenever I press the button I get into Extended sleep mode or exit Extended Sleep Mode.
    Please refer to this project for your implementation.

    Best Regards,
    OV_Renesas
    ble_app_peripheral_wakeup.zip

  • Dear OV,

    Thank you so much for your kindly help. Could you please tell me which part you modified in the example ble_app_peripheral, so that I could learn from it. Thanks.

  • Dear Nick,

    Thank you for the reply.

    Could you please tell me which part you modified in the example ble_app_peripheral, so that I could learn from it

    I worked based on the implementation on the prox_reporter example.
    On user_peripheral.c file the main changes are:

    /**
     ****************************************************************************************
     * @brief Button press callback function. Registered in WKUPCT driver.
     ****************************************************************************************
     */
    static void app_button_press_cb(void)
    {
    	//GO into active mode without extended sleep mode
        arch_set_sleep_mode(ARCH_SLEEP_OFF);
    // configure the wake-up controller for P0_11 
        app_button_enable2();
    }
    
    void app_button_enable(void)
    {
    	//Set the wake-up controller callback to leave Extended Sleep
        wkupct_register_callback(app_button_press_cb);
    
    
            wkupct_enable_irq(WKUPCT_PIN_SELECT(GPIO_BUTTON_PORT, GPIO_BUTTON_PIN), // select pin (GPIO_BUTTON_PORT, GPIO_BUTTON_PIN)
                              WKUPCT_PIN_POLARITY(GPIO_BUTTON_PORT, GPIO_BUTTON_PIN, WKUPCT_PIN_POLARITY_LOW), // polarity low
                              1, // 1 event
                              0); // debouncing time = 0
        
    }
    
    
    static void go_to_sleep(void)
    {
    // Go to extended sleep without OTP copy
    	arch_set_extended_sleep(false);
    //Initialize the Wake-up contoller to trigger an interrupt on P0_11
        app_button_enable();
    }
    
    //Configure the Wake-Up controller for button (P0_11) interrupt and trigger the wake-up controller callback to go into Extended Sleep.
    void app_button_enable2(void)
    {
      //Set the wake-up controller callback to go to extended sleep
        wkupct_register_callback(go_to_sleep);
    
    
            wkupct_enable_irq(WKUPCT_PIN_SELECT(GPIO_BUTTON_PORT, GPIO_BUTTON_PIN), // select pin (GPIO_BUTTON_PORT, GPIO_BUTTON_PIN)
                              WKUPCT_PIN_POLARITY(GPIO_BUTTON_PORT, GPIO_BUTTON_PIN, WKUPCT_PIN_POLARITY_LOW), // polarity low
                              1, // 1 event
                              0); // debouncing time = 0
        
    }

    The initial call to configure the Wake Up controller is on user_app_init custom callback function.

    Also, on the user_periph_setup.h/c files I configured the P0_11 as a Button.


    Best Regards,
    OV_Renesas

  • Dear OV,

    I downloaded your code and tested it, but I failed with my custom board. My board configuration is shown below:

    And I also uploaded the testing video, as you can see, when I used the wire connected to P0.11 to plug the GND on the board, DA14531 seemed enter the extended sleep mode. Actually, the supply current changed from 230uA to tens of uA (17uA to 50uA), but I remember the extended-sleep current should be 3uA. And then I plugged to GND again, DA14531 cannot resume to the active mode. Could you please help to find the problems? Thanks a lot!

  • Dear Nick,

    Thank you for the reply.
    From the video you shared I can see that you are downloading the firmware into the RAM of the DA14531.
    Could you please download the firmware into the SPI Flash and test again? 
    There could be also leakage current from the custom board. Have you made sure you have calibrated the tool you are using for current measurements so it will only get the DA14531 current consumption?

    P.S. I really enjoyed the birds chirping in the background Smiley.

    Best Regards,
    OV_Renesas

  • Dear OV,

    Thanks for your kindly reply.

    I downloaded the firmware into the SPI Flash, but the result is the same.

    I am sure the tool measures the DA14531 current only. You can confirm this from the start of the video.

    And there is no leakage current from the custom board. I tested the current in the extended sleep mode previously, and it can drop to around 3uA.

    So I am still confused.

    Please continue helping on this. Thanks a lot.

    P.S. I am glad you enjoy the birds chirping in my video. 

    Best regards,

    Nick

  • Hi Nick,

    Thank you for the reply. Apologies for the delay.

    . I tested the current in the extended sleep mode previously, and it can drop to around 3uA.

    In which project had you measured the current consumptuion?

    So I am still confused.

    Please check on the SDK6 Release Notes as well:

    If you do not keep the RAM cells detained you will witness a lower current consumption. However, each time you wake-up from Sleep mode (in Extended Sleep mode, each scan/advertise interval) you will have to load again the FW from the SPI Flash which can affect the current consumption as well.

    Best Regards,
    OV_Renesas

  • Dear OV,

    Thanks for your reply.

    I found the second video was just invalid, and now I updated it. You can see from it that I can only put DA14531 into sleep mode but cannot pull it back to the active state. This is the main problem I need your help now.

    About the sleep current issue, I found why the sleep current is around 17uA. I just made a stupid mistake. I forgot there is a serial communication CH340 IC on my board, and it consume around 15uA. Sorry about that.

    Best regards,

    Nick

  • Dear Nick,

    Thank you for the reply.
    Glad you were able to see the expected current consumption.

    You can see from it that I can only put DA14531 into sleep mode but cannot pull it back to the active state. This is the main problem I need your help now.

    Have you burned the FW into the Flash during the test?
    What is the Flash part number integrated on your Dev Kit?
    Have you made any modifications on the Project I shared?

    Best Regards,
    OV_Renesas

  • Dear OV,

    Have you burned the FW into the Flash during the test?
    What is the Flash part number integrated on your Dev Kit?

    Yes, I have burned the FW into Flash during the test.

    The Flash part number is P25Q40.

    Have you made any modifications on the Project I shared?

    No, I did not modify your codes.