This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

LP-EM-CC2340R5: How to know wake up mode from power on or shutdown

Part Number: LP-EM-CC2340R5
Other Parts Discussed in Thread: CC2340R5

Hi teams,

I would like to write a code for wake up function

It had the two modes for waking up

(mode 1) wake up by POWER on from power off state

(mode 2) wake up by LEFT (for example) key triggered from shutdown state

How to know which mode exactly before wake up action

with sample codes better

Regards,

Kevin

  • Hello Kevin

    I hope you are well. For some quick context on the CC2340R5 Device, the PowerCC23X0.h file (C:\ti\simplelink_lowpower_f3_sdk_7_10_00_35\source\ti\drivers\power) has great information pertaining to your question.

    1. For a wake up by power on from a power off state you could use PowerLPF3_RESET_PIN or try PowerLPF3_RESET_POR; these indicate Device reset due to pin reset, and Device booted due to power on reset respectively.

    2. For the mode wakeup from a LEFT event (like left button?) from shutdown state you can use PowerLPF3_RESET_SHUTDOWN_IO (which if you configure wakeup on left button this would indicate when you’ve waked up from shutdown from the left button, or you can set it to any IO pin and send a signal when you want the device to wakeup).

    If you need other power reason modes, there are more listed in the PowerCC23X0.h file. (Remember to use PowerLPF3_ResetReason, example code below setup by a Power_registerNotify callback event)

    static const char *wake_up_mode_callback(PowerLPF3_ResetReason mode)
    {
        switch(mode)
        {
        case PowerLPF3_RESET_PIN: return "reset due to pin reset, Mode 1";
        case PowerLPF3_RESET_SHUTDOWN_IO: return "wakeup event from left button, Mode 2";
        ...//add the other cases here as needed     
        }
    }

    Thanks,
    Alex F