This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Wake-up ble_app_uart device

Hi,

In "ble_app_uart" project, the system will enter sleep mode after 3 mins.

When system enter sleep mode, the "RTT view" will print following message.

0>  <error> app: Fatal error

How to modify this code if I want to wake-up the device by “GPOI 05"

Thank you,

Chianglin

  • Hello Chianglin,

    The reason you see the "app: Fatal error" is that you are debugging while trying to call sd_power_system_off(). If you look at the header file that contains this function, nrf_soc.h, on line 506-510, you can see that it can only return NRF_ERROR_SOC_POWER_OFF_SHOULD_NOT_RETURN (=0x2006). 

    So, usually, when you are not debugging, this function doesn't return, but powers off the chip (enter system off mode, which is the deepest sleep mode). When the device wakes up from this, it will act as a reset. When you are debugging, this function returns a value, which is passed onto APP_ERROR_CHECK(), which will cause an error. What I am trying to say is that this will always fail when you are debugging, but it doesn't happen when you do not debug. It will just enter system off mode.

    You can see that if you define "DEBUG" in your preprocessor defines, the log will say that it receives the error 0x2006 on line 324 in main.c (line number may change if you have changed your main.c file). 

     

    How to modify this code if I want to wake-up the device by “GPOI 05"

     You must modify your bsp_btn_ble_sleep_mode_prepare() to enable an interrupt on pin 5 instead of the button that is already set.

    Best regards,
    Edvin

  • Hi Edvin,

    Thank you for your explain.

    Can I do following modification in bsp_btn_ble.c to enable an interrupt on pin 5?

    	#define BTN_ID_WAKEUP             5  /**< ID of button used to wake up the application. */
    	#define BTN_ID_SLEEP              5  /**< ID of button used to put the application into sleep mode. */
    	#define BTN_ID_DISCONNECT         0  /**< ID of button used to gracefully terminate a connection on long press. */
    	#define BTN_ID_WAKEUP_BOND_DELETE 1  /**< ID of button used to wake up the application and delete all bonding information. */
    	#define BTN_ID_WHITELIST_OFF      1  /**< ID of button used to turn off usage of the whitelist. */
    

    Which pin 5 is connect a switch to GND.

    Thank you

    Chianglin

Related