Cobra IO16 and USBHostController Events

I am using IO16 on the Cobra as an ouput:

static OutputPort DIO_PrintHold_O = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.IO16, false);

With the latest firmware I have a problem.

By itself the output operates normally. However, when I subscribe the following event for the USBHostController the IO goes low and becomes unresponsive to the write command.

USBHostController.DeviceConnectedEvent += OnDeviceConnected;

I can not see any connection between the USBHost and IO16 on the schematic. Can anyone shed light on this? Subscribing to any other event for USBHostController is not a problem such as:

USBHostController.DeviceDisconnectedEvent += OnDeviceDisconnected;
USBHostController.DeviceBadConnectionEvent += OnDeviceBadConnectionEvent;

Thanks

you mention “the latestfirmware”. Any chance you have a mismatched set of GHI SDK version and firmware with the assemblies you have loaded? Easiest way is to create a brand new project, and copy your code into that.

Having said that, I’m going to update my Cobra and give it a try myself.

Repros on my device too.


using System;
using System.Threading;

using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using Microsoft.SPOT.IO;

using GHIElectronics.NETMF.FEZ;
using GHIElectronics.NETMF.USBHost;
using GHIElectronics.NETMF.IO;
using GHIElectronics.NETMF.Hardware;

namespace cobra_test_IO16
{
    public class Program
    {
        public static void Main()
        {
            // Blink board LED

            bool ledState = false;
 
            OutputPort led = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.LED, ledState);
            OutputPort DI1 = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.IO16, false);
            OutputPort DI2 = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.IO17, false);
            OutputPort DI3 = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.IO15, false);

            RemovableMedia.Insert += RemovableMedia_Insert;
            RemovableMedia.Eject += RemovableMedia_Eject;

            // Subscribe to USB events
            // USBHostController.DeviceConnectedEvent += MyDeviceConnectedEvent;

            // Sleep forever

            while (true)
            {
                // Sleep for 500 milliseconds
                Thread.Sleep(2500);

                // toggle LED state
                ledState = !ledState;
                led.Write(ledState);
                DI1.Write(ledState);
                DI2.Write(ledState);
                DI3.Write(ledState);
            }
        }

        static void RemovableMedia_Insert(object sender, MediaEventArgs e)
        {
            Debug.Print("Storage \"" + e.Volume.RootDirectory +
            "\" is inserted.");

        }
        static void RemovableMedia_Eject(object sender, MediaEventArgs e)
        {
            Debug.Print("Storage \"" + e.Volume.RootDirectory +
            "\" is ejected.");
        }


        static void MyDeviceConnectedEvent(USBH_Device device)
        {
            Debug.Print("Device connected...");
            Debug.Print("ID: " + device.ID + ", Interface: " + device.INTERFACE_INDEX + ", Type: " + device.TYPE);
        }

        static void MyDeviceDisconnectedEvent(USBH_Device device)
        {
            Debug.Print("Device disconnected...");
            Debug.Print("ID: " + device.ID + ", Interface: " + device.INTERFACE_INDEX + ", Type: " + device.TYPE);
        }

    }

}

measure voltage on IO15, IO16, IO17 with the above code (with OnDeviceConnected commented out) and it measures 3v3 when the LED is on, then 0 when the LED goes off, then 3v3 etc. Take out the comments and deploy it, IO15 and IO17 work as before but IO16 stays at 0v.

Thank you.
Move the USBHostController.DeviceConnectedEvent += MyDeviceConnectedEvent;
to the begining of the program (before creating a Port with IO 16), it should work.
We are looking into the problem now.

Any news about this issue?