Can you please describe the function of the wakeup pin
Thank You
Paul H
Can you please describe the function of the wakeup pin
Thank You
Paul H
Hello Paul,
The wakeup input pin can be used to get the device out of sleep or hibernate mode.
It can be used as GPIO pin (P0.4) or can be left unconnected when unconfigured.
Thanks,
Rolf
Hi,
I can’t seem to find any information about the wakeup pin. As I understand it, almost any GPIO pin can be connected to an interrupt, which can be made to function in deep sleep. If this is true, why would anyone the wakeup pin instead of a regular GPIO pin with interrupt?
Am I missing something?
Paul G
Hi Paul,
P0.4 should be used for wakeup from sleep because it is internally configured in the stack.
Tom
Understood. Thanks for the info.
If I attach a deep sleep capable interrupt to another GPIO pin, will it also wake up the module from deep sleep?
Paul
Hi Paul,
P0.4 wakes up the stack and therefore the whole modue, and is easy to use.
Can you elaborate, why would you need a different pin? Maybe I can help
Tom
Hi Tom,
I have a pushbutton that I want to behave as follows:
To do this, I need a pin to wake up the processor and generate an interrupt. With the current stack, can I attach an interrupt to port 0.4 without interfering with the wakeup feature?
Paul
Hi Paul
what you can do as well is the following. Have the button on P0.4, and after the device wakes up, see how long the button is pressed.
LoRaWAN_Sleep(sleepconfig);
if (Cy_GPIO_Read(P0_4_PORT, P0_4_NUM) == 0) /* Button released */
{
// if (stateTimer == 0), so it was not woken with a button but on time, nothing happens, continues normally
if ((stateTimer > 0) && (stateTimer <= 1000)) // button held less than 10s, short press
{
// Short press causes processor to reset.
}
else
if (stateTimer > 1000) // button held more than 10s, long press
{
// Long press (~ 10 seconds) resets settings to default values, then resets processor.
}
}
else /* Button is still pressed */
{
++stateTimer;
if (stateTimer == 1) // OPTIONAL
{ // OPTIONAL
// Turn on orange led to signal reset // OPTIONAL
} // OPTIONAL
if (stateTimer == 300) // OPTIONAL
{ // OPTIONAL
// Turn on red led to signal factory reset // OPTIONAL
} // OPTIONAL
CyDelay(10); // 10ms
}
break; // end of case State_ButtonPressed
This sleep is with the rising edge of the button, internal pulldown enabled, with the following sleepConfig:
sleepConfig_t sleepConfig =
{
.sleepMode = modeDeepSleep,
.BleEcoON = false,
.DebugON = false,
.sleepCores = coresBoth,
.wakeUpPin = wakeUpPinHigh(true),
.wakeUpTime = wakeUpDelay(0, 1, 0, 0),
};
P.S. wrote this code on the forum, not actually buit, may have errors
Tom