Spider with 4.2.7 caused bluescreen and Undef Instr

since i updated to 4.2.7 last friday, my spider is a bit unstable: ~10 bluescreens and sometimes i got an Undef Instr (see image below) on my CP7 during deploy.
i stepped back to 4.2.5 and all works fine.

Did you update tinytbooter to the latest? Can we get a test example on how to repro please?

i updated the tinybooter to 4.2.7, according to the information of the FEZSpiderMainboardUpdater. never checked it with MFDeploy.

i will reflash 4.2.7 and try to repro the issue with a simple code.

i uninstalled all GHI & Seeeds stuff listed in the system control and reinstall the new SDK inc. driver.
i flashed 4.2.7 fw and tinybooter with the updater from the sdk.
Windows 7 (x64) installs the driver of the bootloader (but no new emx driver) automatically.
i noticed that in the “C:\Program Files (x86)\GHI Electronics” directory is no driver directory as in the last SDK, so i cant install the emx driver manually.

  1. deployed ~20x a simple code (see below), works.
  2. deployed ~20x a code with ENC28 support and ping (posted in the thread: “spider ethernet not working with 4.2 sdk ?”), works.
  3. deployed ENC28 with WPF code, spider stucks at “The debugging target is not in an initialized state; rebooting…” (happen once in a while, is no problem under 4.2.5, unplug/plug spider and it goes on with “Found debugger!”)
    unplug the spider => bluescreen (device driver)
    (code deploy was successfull, after replug the spider the app works)
  4. deployed simple code from (1.), works
  5. deployed simple code from (1.), spider stucks at "The debugging target is not in an initialized state; rebooting…"
    unplug the spider => bluescreen (device driver)

from the experience of the last weekend, it makes no difference if i unplug or press the reset button if the spider stucks at “The debugging target…”

the “Undef Instr” not appears so far.

simple code (1.):


using System.Threading;
using Gadgeteer.Modules.GHIElectronics;
using Microsoft.SPOT;
using GT = Gadgeteer;

namespace FW427Test
{
    public partial class Program
    {
        void ProgramStarted()
        {
            button.ButtonPressed += new Button.ButtonEventHandler(button_ButtonPressed);
            Debug.Print("Program Started");
            display_CP7.SimpleGraphics.DisplayEllipse(GT.Color.Blue, 400, 240, 200, 200);
        }

        void button_ButtonPressed(Button sender, Button.ButtonState state)
        {
            Debug.Print("button pressed");
            Thread.Sleep(300);
        }
    }
}

code with WPF (3.):


using System;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using Gadgeteer.Modules.GHIElectronics;
using GHI.Premium.Net;
using Microsoft.SPOT;
using GHI.Premium.Hardware;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Presentation.Media;
using Microsoft.SPOT.Presentation.Shapes;
using Microsoft.SPOT.Hardware;

using GT = Gadgeteer;


namespace EthTest
{
    public partial class Program
    {
        private static EthernetENC28J60 Eth1 = new EthernetENC28J60(Microsoft.SPOT.Hardware.SPI.SPI_module.SPI1, EMX.Pin.IO15, EMX.Pin.IO46, EMX.Pin.IO6);

        private static ManualResetEvent NetworkAvailablityBlocking = null;
        private static ManualResetEvent IPAddressSetResetEvent = null;
        private static string myIP = "192.168.1.55";

        private static Window window;
        private static Text textClock;

        void ProgramStarted()
        {
            Debug.Print("Program Started");

            CreateUI();

            // set button event
            button.ButtonPressed += new Gadgeteer.Modules.GHIElectronics.Button.ButtonEventHandler(button_ButtonPressed);

            // set ethernet events
            Eth1.CableConnectivityChanged += new EthernetENC28J60.CableConnectivityChangedEventHandler(Eth1_CableConnectivityChanged);
            Eth1.NetworkAddressChanged += new NetworkInterfaceExtension.NetworkAddressChangedEventHandler(Eth1_NetworkAddressChanged);

            // init ethernet
            Thread threadInitEthernet = new Thread(new ThreadStart(InitEthernet));
            threadInitEthernet.Start();

            GT.Timer timer = new GT.Timer(200); // every second (1000ms)
            timer.Tick += new GT.Timer.TickEventHandler(timer_Tick);
            timer.Start();
        
        }

        void timer_Tick(GT.Timer timer)
        {
            textClock.TextContent = DateTime.Now.ToString();
        }

        void button_ButtonPressed(Gadgeteer.Modules.GHIElectronics.Button sender, Gadgeteer.Modules.GHIElectronics.Button.ButtonState state)
        {
            Debug.Print("button pressed");
        }

        private void CreateUI()
        {
            window = display_CP7.WPFWindow;

            window.Height = SystemMetrics.ScreenHeight;
            window.Width = SystemMetrics.ScreenWidth;
            Canvas csUI = new Canvas();
            csUI.Width = 800;
            csUI.Height = 100;
            Rectangle rec = new Rectangle(800, 100);
            rec.Stroke = new Pen(Color.White, 1);
            csUI.Children.Add(rec);

            textClock = new Text(Resources.GetFont(Resources.FontResources.NinaB), "");

            textClock.Width = 150;
            textClock.Height = 30;
            textClock.ForeColor = GT.Color.Red;
            Canvas.SetLeft(textClock, 2);
            Canvas.SetTop(textClock, 2);
            csUI.Children.Add(textClock);

            window.Child = csUI;

            window.Background = new SolidColorBrush(Color.Black);
            window.Visibility = Visibility.Visible;
        }

        #region Ethernet
        private void InitEthernet()
        {
            IPAddressSetResetEvent = new ManualResetEvent(false);

            Eth1.Open();

            // wait on event 'Eth1_NetworkAddressChanged' if ip already set
            Thread.Sleep(1000);

            if (NetworkInterfaceExtension.AssignedNetworkInterface == null)
            {
                Debug.Print("no network interface assigned!");
                Debug.Print("assign...");
                try
                {
                    NetworkInterfaceExtension.AssignNetworkingStackTo(Eth1);
                }
                catch (Exception)
                {
                    NetworkInterfaceExtension.AssignNetworkingStackTo(Eth1);
                }
                Debug.Print("AssignedNetworkInterface: " + NetworkInterfaceExtension.AssignedNetworkInterface.ToString());
            }
            else
                Debug.Print("AssignedNetworkInterface: " + NetworkInterfaceExtension.AssignedNetworkInterface.ToString());

            // check if ip allready setted
            if (Eth1.NetworkInterface.IPAddress != myIP)
            {
                Debug.Print("set ip.");
                Eth1.NetworkInterface.EnableStaticIP(myIP, "255.255.255.0", "192.168.1.100");
            }
            else
                Debug.Print("ip already set.");

            if (!Eth1.IsCableConnected)
            {
                NetworkAvailablityBlocking = new ManualResetEvent(false);

                do
                {
                    if (!Eth1.IsCableConnected)
                    {
                        Debug.Print("Ethernet cable is not connected yet.");
                    }
                    else
                        break;
                } while (!NetworkAvailablityBlocking.WaitOne(5000, false));
            }

            while (!IPAddressSetResetEvent.WaitOne(500, false))
            {
                Debug.Print("IP address is not set yet.");
            }
            Debug.Print("IP address is set");
            Thread threadGetTime = new Thread(new ThreadStart(NTPTime));
            threadGetTime.Start();

        }

        void Eth1_CableConnectivityChanged(object sender, EthernetENC28J60.CableConnectivityEventArgs e)
        {
            Debug.Print("Built-in Ethernet Cable is " + (e.IsConnected ? "Connected!" : "Disconneced!"));
            if (e.IsConnected)
                NetworkAvailablityBlocking.Set();
        }

        static void Eth1_NetworkAddressChanged(object sender, EventArgs e)
        {
            Debug.Print("New address for The built-in Ethernet Network Interface ");
            Debug.Print("Is DhCp enabled: " + Eth1.NetworkInterface.IsDhcpEnabled);
            Debug.Print("Is DynamicDnsEnabled enabled: " + Eth1.NetworkInterface.IsDynamicDnsEnabled);
            Debug.Print("NetworkInterfaceType " + Eth1.NetworkInterface.NetworkInterfaceType);
            Debug.Print("Network settings:");
            Debug.Print("IP Address: " + Eth1.NetworkInterface.IPAddress);
            Debug.Print("Subnet Mask: " + Eth1.NetworkInterface.SubnetMask);
            Debug.Print("Default Getway: " + Eth1.NetworkInterface.GatewayAddress);
            Debug.Print("Number of DNS servers:" + Eth1.NetworkInterface.DnsAddresses.Length);
            for (int i = 0; i < Eth1.NetworkInterface.DnsAddresses.Length; i++)
                Debug.Print("DNS Server " + i.ToString() + ":" + Eth1.NetworkInterface.DnsAddresses[i]);
            Debug.Print("------------------------------------------------------");
            if (Eth1.NetworkInterface.IPAddress == myIP || Eth1.NetworkInterface.IPAddress != "0.0.0.0")
                IPAddressSetResetEvent.Set();
        }

        public void NTPTime()
        {
            string TimeServer = "131.188.3.221";
            int GmtOffset = 60;
            Socket s = null;
            try
            {
                IPHostEntry host = Dns.GetHostEntry(TimeServer);
                EndPoint rep = new IPEndPoint(host.AddressList[0], 123);
                s = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
                byte[] ntpData = new byte[48];
                Array.Clear(ntpData, 0, 48);
                ntpData[0] = 0x1B; // Set protocol version
                s.SendTo(ntpData, new IPEndPoint(host.AddressList[0], 123));

                if (s.Poll(10 * 1000 * 1000, SelectMode.SelectRead)) // Waiting an answer for 30s, if nothing: timeout
                {
                    s.ReceiveFrom(ntpData, ref rep); // Receive Time
                    byte offsetTransmitTime = 40;
                    ulong intpart = 0;
                    ulong fractpart = 0;
                    for (int i = 0; i <= 3; i++) intpart = (intpart << 8) | ntpData[offsetTransmitTime + i];
                    for (int i = 4; i <= 7; i++) fractpart = (fractpart << 8) | ntpData[offsetTransmitTime + i];
                    ulong milliseconds = (intpart * 1000 + (fractpart * 1000) / 0x100000000L);
                    s.Close();
                    DateTime dateTime = new DateTime(1900, 1, 1) + TimeSpan.FromTicks((long)milliseconds * TimeSpan.TicksPerMillisecond);
                    Utility.SetLocalTime(dateTime.AddMinutes(GmtOffset));
                    RealTimeClock.SetTime(DateTime.Now);
                    Debug.Print("Receive Time OK");
                    //return true;
                }
                else
                {
                    Debug.Print("Receive Time FAILED");
                }
                s.Close();
            }
            catch
            {
                try { s.Close(); }
                catch { }
            }
        }

        #endregion

    }
}

Are you looking for the WinUSB drivers? They are now located at “C:\Program Files (x86)\GHI Electronics\GHI Premium NETMF v4.2 SDK\USB Drivers\GHI_NETMF_WinUsb” and there is a Wiki article to help with installing them if you have any trouble. Home - GHI Electronics

And to verify, you are no longer getting the “Undef Instr” after updating again?

It was a bit confusing.
The SDK (10-24-2012) installs a driver package at “C:\Program Files (x86)\GHI Electronics\GHI NETMF USB Driver Set”. i saw that first and installed it. works fine with 4.2.5 but not with 4.2.7.
At the SDK (11-29-2012) this folder not exists.

Now i installed the driver from “C:\Program Files (x86)\GHI Electronics\GHI Premium NETMF v4.2 SDK\USB Drivers\GHI_NETMF_WinUsb” manually and it works so far.
i deloyed the 2 codes from above several times and no bluescreen or Undef Instr so far.

ty :slight_smile: