Main Site Documentation

Application lockup


I was playing around with some code and did something like (I lost the code) :

 .... = new OutputPort((Cpu.Pin)FEZ_Pin.Interrupt.IO18.....

The application compiled with no errors and I downloaded the code. The code must have been running to the above line and then locked up …

Resetting the Cobra would launch the application again. I was not able to deploy from Visual Studio, MFDeploy would not ping nor erase

I finally had to get into the bootloader over serial and erase and reload the firmware to get MFDeploy and VS to normal.

Is there an easier way to erase the NETMF app. in this case ? I would be happy if I someone can point me to the documentation or previous posts.


Yes there is an easy way, click the “erase” button on MFDeploy :wink:

If the device is locked up then hold up+down buttons while you reset the device to enter TinyBooter then you cal click the erase button on MFDeploy

We would need to see the code that you used to lockup the device!


I have lost the code but will redo that tommorow and post. It is a peice of buggy code but I will put it up for sure.

I did click “erase” on MFDeploy but not in TinyBooter mode.


My cobra gets stuck with visual studio too.
Deployment succeeds, program runs.

When I try to deploy new code, 8 out of 10 times visual studio either can’t find EMX or visual studio crashes.

With my domino, this does not happen.


Robert, this is an issue with the 4.1 SDK and VS 2010, as it doesn’t affect Matt, who is using VS2008 and NETMF 4.0


Would the beta help? Did not try it yet, since I am still testing your program…


The GHI beta will not help, no, at least not in my experience.


I managed to create the code to lock. I am sure that the code is to blame but is 100% sure to lock your board.

using System;

using Microsoft.SPOT;
using Microsoft.SPOT.Input;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Hardware;
using GHIElectronics.NETMF.FEZ;
using Microsoft.SPOT.Presentation.Media;
using System.Threading;

namespace MFWindowApplication1
    public class Program : Microsoft.SPOT.Application
        static Bitmap LCD;
        static Font MyFont;

        public static void Main()
            MyFont = Resources.GetFont(Resources.FontResources.small);

            LCD = new Bitmap(SystemMetrics.ScreenWidth, SystemMetrics.ScreenHeight);
            LCD.DrawText("Application lock 1", MyFont, Colors.Red, 10, 10);

            OutputPort Port1 = new OutputPort((Cpu.Pin)FEZ_Pin.Interrupt.IO19, true);

            //This is the line that causes the app. to lock up
            Port1.OnInterrupt += new NativeEventHandler(Port1_OnInterrupt);


        static void Port1_OnInterrupt(uint data1, uint data2, DateTime time)
            //throw new NotImplementedException();



This is a known issue, it is related to your code not using the OutputPort properly.

The events can ONLY be used with InterruptPort objects. Using it with OutputPort and with InputPort doesn’t make sense anyway and if you try to install an event handler you will simply crash the system!

Ideally you would get an exception if you tried to do that but what you are doing is wrong anyway :wink:


Thanks Gus, will have to take care in future :slight_smile: