Thread.Sleep freezing on G30

I have been running the code below on a G30 and the program freezes on the Thread.Sleep function calls after a seemingly random amount of loops. The debugger won’t step past the call and I am at a loss as to why this is happening.

using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;

namespace NETMFBook
{
public class Program
{
public static void Main()
{
OutputPort RED = new OutputPort(GHI.Pins.G30.Gpio.PB8, true);
OutputPort GRN = new OutputPort(GHI.Pins.G30.Gpio.PB9, true);

        GRN.Write(false);
        RED.Write(false);
        Thread.Sleep(500);


        SPI.Configuration MyConfig =

new SPI.Configuration(Cpu.Pin.GPIO_Pin1,
false, 0, 0, false, true, 1000, SPI.SPI_module.SPI1);

        SPI MySPI = new SPI(MyConfig);

        byte[] tx_data = new byte[2];
        byte[] rx_data = new byte[2];
        int counter = 0;
        while (true)
        {
            byte i = 0;
            Debug.Print(counter.ToString());

            //Debug.Print(Debug.GC(false).ToString());

            for (i = 0; i < 100; i++)
            {
                string o = i.ToString();
                //Debug.Print(o);
                tx_data[0] = GetNumber(i / 10);
                tx_data[1] = GetNumber(i % 10);
                MySPI.Write(tx_data);
                Thread.Sleep(40);
            }

            RED.Write(!RED.Read());
            GRN.Write(!GRN.Read());
            Thread.Sleep(1000);
            counter++;

        }

    }

    public static byte GetNumber(int Number)
    {
        switch (Number)
        {
            case 0:
                return 126;//254;
            case 1:
                return 12;//96;
            case 2:
                return 182;//109;
            case 3:
                return 158;
            case 4:
                return 204;
            case 5:
                return 218;
            case 6:
                return 250;
            case 7:
                return 14;
            case 8:
                return 254;
            case 9:
                return 222;

        }
        return 0;
    }
}

}

Please update to the latest firmware found in the latest sdk release.

1 Like

Was this G30 specific or an General issue?

Specific

1 Like

Thanks for your help, this solved my problem. Silly of me not to check the firmware.