AnsweredAssumed Answered

Trying to switch between host and device on one usb

Question asked by Daniel Winsor on Jun 15, 2017
Latest reply on Jun 19, 2017 by Daniel Chen

I have a device with one USB port.   I use it to create a virtual com port.  this works fine.

if I reconfigure the sw on my board as a usb device, I can connect my board to a PC and it looks like a storage device.

My question is, does anyone have an example of switch from host to device mode and back to host without a shutdown?

 

When I try to shut down the host stack and go to device mode I am ok. 

Then, when I try to shut down device mode and bring up host mode again, I get error C1 (USBERR_DEVICE_BUSY)

 

Here is how I shut down:

 

_int_disable();
_usb_host_bus_control(host_handle,USB_ASSERT_BUS_RESET);
_usb_host_shutdown(host_handle);
bShutdownGood = true;
_int_enable();

 

 

Any examples of switching between host and device mode without a shutdown would be appreciated!

 

Thanks so much!

 

 

Dan.

Outcomes