Some digital pins not working?

I’m a FEZ newb and I’m tearing my hair out. Thanks for you help.

When I run the following code…:

OutputPort pin = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.Di13, true);

… I get the following error:
An unhandled exception of type ‘System.Exception’ occurred in Microsoft.SPOT.Hardware.dll

I get this with digital pins 11 & 13… but 12 works fine!? This happens even if this is the only line of code in my main procedure.

Could these pins be damaged? Or have they retained some ‘state’ from previous use? I have reloaded the firmware and the problem persists.

For now, I am using pin 12 for my purposes (controlling a serial display) and it works but I remained baffled by these ‘non-working’ pins…

Hope this is clear. Any ideas? Is there some diagnotics test I can run?

Thanks for your feedback.


Do not pull your hair out :slight_smile: Instead, make a new project and only add that line of code

Here is my program and it works perfectly!

using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using GHIElectronics.NETMF.Hardware;
using GHIElectronics.NETMF.FEZ;

namespace GHIElectronics.NETMF.FEZ
    class Program
        public static void Main()
            OutputPort pin = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.Di13, true);

            while (true)


urghhh! It seems to work… but whhhhhyyyyyy?

Thank you Gus. You rock!

You could check the rest of your code (or even post it) so that we can have a look at it ?

any chance

OutputPort pin



get confused during compile?

I have the same problem but only with the digital output 13.

My code is:

using System;
using Microsoft.SPOT;
using System.Threading;
using Microsoft.SPOT.Hardware;
using GHIElectronics.NETMF.FEZ;

namespace FEZ_Domino_Application1
public static partial class LCD162bDriver
static OutputPort LCD_LED;

    static OutputPort LCD_RS;
    static OutputPort LCD_RW;
    static OutputPort LCD_E;

    static OutputPort LCD_D0;
    static OutputPort LCD_D1;
    static OutputPort LCD_D2;
    static OutputPort LCD_D3;
    static OutputPort LCD_D4;
    static OutputPort LCD_D5;
    static OutputPort LCD_D6;
    static OutputPort LCD_D7;

    public static void Initialize()
        LCD_LED = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.Di3, false);
        LCD_RS = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.Di4, false);
        LCD_RW = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.Di5, false);
        LCD_E = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.Di6, false);

        LCD_D0 = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.Di7, false);
        LCD_D1 = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.Di8, false);
        LCD_D2 = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.Di9, false);
        LCD_D3 = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.Di10, false);
        LCD_D4 = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.Di11, false);
        LCD_D5 = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.Di12, false);
        LCD_D6 = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.Di13, false);    <---- CRASH HERE
        LCD_D7 = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.Di0, false);


when crash i have the following error:
An unhandled exception of type ‘System.Exception’ occurred in Microsoft.SPOT.Hardware.dll

Can you help me???


You are replying to a one year old thread!

So we can help you better, please start new thread and indicate your device, your setup and please code tag your code so it is readable.

Thought I saw something in the code but I can’t seem to delete this.