Power.Shutdown() fails with System.NotSupportedException on PICO

When calling Power.Shutdown(true, rtc.Now + TimeSpan.FromSeconds(10)); on a PICO, Shutdown always fails with System.NotSupportedException.

Seems to be related to use of the WKUP pin. If Power.Shutdown() is called with wkupPIN=false, then Shutdown works.

Here’s some example code to demonstrate the problem.
Not using PA0 (WKUP) anywhere in example code.
Using Firmware 2.2.0.5100 on a PICO.

namespace Pico_Shutdown_Fails
{
    internal class Program
    {
        static GpioPin _Button;
        static GpioPin _Blue_LED;
        static RtcController rtc;

        static void Main()
        {

            rtc = RtcController.GetDefault();
            rtc.Now = new DateTime(2023, 4, 12);
            SystemTime.SetTime(rtc.Now);

            _Button = GpioController.GetDefault().OpenPin(SC13048.GpioPin.PC13);
            _Button.SetDriveMode(GpioPinDriveMode.InputPullUp);
            _Blue_LED = GpioController.GetDefault().OpenPin(SC13048.GpioPin.PA8);
            _Blue_LED.SetDriveMode(GpioPinDriveMode.Output);

            while (_Button.Read() != GpioPinValue.Low)
            {
                Thread.Sleep(100);
                _Blue_LED.Write(GpioPinValue.High);
            }
            _Blue_LED.Write(GpioPinValue.Low);

            // ALWAYS fails with System.NotSupportedException when wkupPin=true
            Power.Shutdown(true, rtc.Now + TimeSpan.FromSeconds(10));
        }
    }
}

You need to set Wakeup edge.

SC13xxx does support Rising only. You need to add the code as below:

Power.WakeupEdge = WakeupEdge.Rising;

Power.Shutdown(true, rtc.Now + TimeSpan.FromSeconds(10));

Ah ha ! Thanks for the quick response.

I guess I missed that SC13048 needed that option set in the documentation.

Works perfect now.
Don

1 Like