Main Site Documentation

USB: Unknown device


#1

Very rarly the USB device is not recoganized by the PC. So I need to power cycle the board.
I am thinking of restarting the USB controller if I detect a unplug and plug back in to the PC.
This is how I start my device now.

How do I restart it.

                // This is used for reading and writing
                UsbCStream = device.CreateUSBStream(WRITE_EP, READ_EP);
                UsbCStream.ReadTimeout = 10;
                UsbCStream.WriteTimeout = 200;

                // All done, you can start the device now
                USBClientController.Start(device);

#2

To stop, use USBClientController.Stop();
Then you can start again…


#3

Is that
Same as a restart


#4

This is the only way to restart (stop then start)


#5
#### Exception System.InvalidOperationException - CLR_E_INVALID_OPERATION (5) ####
#### Message:
#### GHIElectronics.NETMF.USBClient.USBClientController::Init [IP: 0000] ####
#### GHIElectronics.NETMF.USBClient.USBClientController::Start [IP: 0104] ####
#### MicLogger.USBInterface::USBActivityCheck [IP: 003c] ####
#### MicLogger.USBInterface::USBLoop [IP: 0008] ####

20:06:US:Exception was thrown: System.InvalidOperationException

The library does not explain this.
When does the above exception happen. So I can fix it.
I am doing a start/stop

it is in Suspended(6), when I started it


#6

I made the code like if the contoller is in suspend then do not stop.
It looks good. Hope fully it solves my issue
All this was done on USBizi

On EMX there is a different issue to handle this condition

26 P1.30 N/A USB_VBUS1 USB device power detect signal. Connect to power pin on USB device.

I think I do not have access to this pin, because of VBUS.
Do you guys restart it when the PC connection is removed? or when VBUS goes low?


#7

VBUS is not checked nor used on our USB drivers.


#8

Then how can I make
Pin 26(P1.30) an input pin
So I can control using it.

We have already made many boards,


#9

Many questions have been answered already on this forum. I did a quick search for VBUS and found http://tinyclr.com/forum/10/3864/