Use of WKUP input after Power.Shutdown

What is exactly connected to the pin? And how do you set it high and low?

I test it with MMA8452Q and MCP23008 circuits where I can set the interrupt polarity. I have verified the functionality of the settings.

I did more tests. When the pin goes from low to high never wake up, the opposite always works. I used an external pull down resistor. Can anyone verify this? If you use the button beware of debouncing.

We will test. Please confirm you are using preview 3

preview 2 :-/ with dev boards SCM20260D Rev C and SC20100S Rev B

Any reason for not using preview 3?

I have no serious reason, I will test it later with preview 3

It behaves the same with preview 3.

Looking at our code, only falling edge is supported. To support rising, we need to change the API. We are not sure if we want to do that yet so for now consider it as only falling edge is supported. https://github.com/ghi-electronics/TinyCLR-Libraries/issues/837

Okay. We will adapt our design to the current state.

I have one more question about waking up. How do I get a reason to wake up? (PIN or RTC)

Good question. Can you please add to the issue so we can take care of it for you?

1 Like

Does this help? There is no pin or rtc yet.

I know this functionality, but it is insufficient. I need to distinguish whether the wake-up was caused by the user or the RTC. If possible, add it there. Alternatively, if this information is available through a register, let’s try Marshal. Do you know where this information is located and is available through Marshal?

6.8.8 PWR wakeup flag register (PWR_WKUPFR)

Bits 5:0 WKUPn+1: Wakeup pin WKUPn+1 flag.
This bit is set by hardware and cleared only by a Reset pin or by setting the WKUPCn+1 bit in the
PWR wakeup clear register (PWR_WKUPCR).
0: No wakeup event occurred
1: A wakeup event was received from WKUPn+1 pin

Marshal.ReadInt32((IntPtr)0x58024800 + 0x24)
2 Likes

After wake up read PWR wakeup flag register (PWR_WKUPFR)

Marshal.ReadInt32((IntPtr)0x58024800 + 0x24)

Before shutdown clear PWR_WKUPFR through PWR wakeup clear register (PWR_WKUPCR)

Marshal.WriteInt32((IntPtr)0x58024800 + 0x20, 0x01);

Result: grrrrrrrrrrrrrr Always after wake up PWR_WKUPFR.WKUPF1 == 1, even if the system is wake up via the RTC

1 Like

How about reading bit 8 in RTC_ISR?

1 Like

It works, thanks :clap: :grinning:

2 Likes

@Majo Important change is going to happen here. We are going to fix this at a wakeup from rising edge in the next release. In low power, it makes more sense to have the pin low when in shutdown. Consider this in your design please.

Ohh come on, i just made a design where i pull up the wakeup pin with external resistor
Why does it make more sense?
usually buttons are triggered to ground so if its up when in shutdown the button will wakeup the system

Consider options for wake up pin: RisingEdge, FallingEdge and None.
Currently, the falling edge also suits us.