This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

OMAP-L138: USB OTG Role Swap OMAP-L138

Part Number: OMAP-L138
Other Parts Discussed in Thread: OMAPL138

Hi,

We're using the OMAP-L138 and its USB OTG module.

Right now depending on the situation we would need the OMAP-L138 to act either as a USB host, or a USB device.

Both host and device code is working individually, and now I'm working on how to swap between the roles.

My main question is this, are there any close, deinitilization, or destructor methods that need to be called between configuring the USB OTG module as a different role?

The below example is a rough idea of what might be done to go from a USB device configuration, to a USB host configuration:

// Configure the USB OTG module as a bulk device
usb_dev_params.usbMode = USB_DEVICE_BULK_MODE;
usb_dev_params.instanceNo = USB_DEV_INSTANCE;  /* USB port # */
usb_dev_params.usbClassData = (void*)&g_sBulkDevice;
usb_handle = USB_open(usb_dev_params.instanceNo, &usb_dev_params);   
// perform bulk device tasks
// now deinitialize the USB OTG module before configuring it as a USB Host role
// now configure the USB OTG module to be in host mode
usb_host_params.usbMode      = USB_HOST_MSC_MODE;
usb_host_params.instanceNo   = USB_INSTANCE;
usb_handle = USB_open(usb_host_params.instanceNo, &usb_host_params);

// perform USB Host tasks

Any input on the situation would be helpful!

Thanks,

Ben