G120: MassStorage failed on Win8

Fun problem…

G120: MassStorage works fine on Win7 - but failes failed on Win8.

From Device Manager

"The device can not start. (Code 10)

{Device Timeout}
The specified I / O operation on% hs was not completed before the timeout period expired."

I get the same error for the FW Update USB Driver on Win 8 (as many others). May be this is a related problem.

Show code to us so we can do a quick test please :)))

Here is the code:

It has been used on the EMX for along time on Win7


// if USB Power is ON (VBUS, IO Pin)

                if (VBUS.Read())
                {
                    try
                    {
                        // Attach SD Card as MassStorage
                        USBC_MassStorage ms = USBClientController.StandardDevices.StartMassStorage();
  look   ->             Thread.Sleep(100);
                        sdPS = new PersistentStorage("SD");
                        ms.AttachLun(0, sdPS, " ", " ");
                        ms.EnableLun(0);

                        // wait to connect to PC
                        while (USBClientController.GetState() != USBClientController.State.Running)
                        {
                            Debug.Print("Waiting to connect to PC...");
                            Thread.Sleep(1000);
                        }

                        Debug.Print("PC Connected");
                        Thread.Sleep(1000);

                        // Wait for PC disconnect
                        while (VBUS.Read())
                        {
                            // Blink MassStorage and Button LED
                           LED_Y.Write(!LED_Y.Read());
                            Thread.Sleep(1000);
                        }

                        // Disable MassStorage
                        Debug.Print("PC is disconnected...");
                        ms.DisableLun(0);
                        sdPS.Dispose();
                    }
                    finally
                    {
                        PowerState.RebootDevice(false);
                    }
                }

Note: Look ->

I this location I had used a delay of 1000 msec for a long time.
On ealier versions on NETMF this stopped an Exception, that shoved up from time to time on EMX.
Reducing it to 100 ms, makes it work on Win8 and win7.
This break might no longer be nessary - but I keep it to be sure. It hate periodic exceptions.
It seem that Win8 have shorter timeouts than Win7 - properly to make it faster.

  • this we know from Visualstudio, the debugger timeout = coffe break.

@ nsb -

Thank you very much, you gave us a way to go :))))
We will check because there should not need any delay in there.