G120 DeepSleep not waking up

Newest firmware, Cobra II, the below code does not wake up, minimal possible code-snippet to replicate. What am I doing wrong?

Still baffled by this custom board guy doing stuff without posting at all :think:


using System;
using System.Collections;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Presentation.Media;
using Microsoft.SPOT.Presentation.Shapes;
using Microsoft.SPOT.Touch;
using Microsoft.SPOT.Hardware;

using Gadgeteer.Networking;
using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;
using G120 = GHI.Pins.G120;


namespace G120DeepSleepTest
{
    public partial class Program
    {
                private readonly static InterruptPort _LDR1 = new InterruptPort(G120.P0_22, true, Port.ResistorMode.PullUp,          Port.InterruptMode.InterruptEdgeLow);

        void ProgramStarted()
        {
            Debug.Print("Program Started");
            _LDR1.OnInterrupt += interrupt_OnInterrupt;
            flash(500, 5);
            PowerState.WakeupEvents |= HardwareEvent.OEMReserved1;
            PowerState.Sleep(SleepLevel.DeepSleep, HardwareEvent.OEMReserved1);
            flash(1000, 8);
            
        }

        void flash(int pause, int steps)
        {
            for (int i = 1; i <= steps; i++)
            {
                PulseDebugLED(); Thread.Sleep(pause);
            }
        }
        
        void interrupt_OnInterrupt(uint data1, uint data2, DateTime time)
        {
            flash(500, 2);
            Debug.Print("LDR1 pressed!");
        }
        
    }
}

@ njbuch -

Make sure that VS debug is disconnected.

@ Dat - Thanks for getting back. It works for me now. My problem was initially that I had a characterdisplay in the socket on the Cobra II, which got turned off when returning from sleep. No clue why, but it looked like there was something wrong. I have changed to socket 7, and now it works.