cancel
Showing results for 
Search instead for 
Did you mean: 

MX, USB and Host vs. Device support

hbarta2
Associate III
Posted on July 09, 2015 at 17:18

Hi folks,

New to USB here. I know (more or less 😉 ) what the difference between host and device are but not a lot more.

When configuring USB via 'MX, I find that if I set USB_OTG_FS as Host_Only, the USB Host middleware is available. Likewise configure as Device_Only, the Device middleware is available. If I configure USB_OTG_FS as OTG/Dual_Role_Device, then neither Host nor Device middleware is available. (Activate_SOF is not available to configure as the related GPIO pin is already configured for another input.)

Why is this? I would expect with dual role, I would be able to configure both Host and Device middlewares.

Is this a middleware library limitation? Does HAL not support dual role devices? (I'm just starting on reviewing UM1720 (host library) and UNM1734 (device library) and perhaps will find the answer there.)

At present I may need to either detect that a USB cable connects the device to a PC or that a USB flash drive has been connected via OTG cable, depending on which way the powers that be decide to go. I think I need the device library for the former and the host library for the latter and it would be nice to get both configured while I wait for an answer.

Feel free to offer alternate suggestions.

Thanks!

#usb-host-device-stm32cubemx
2 REPLIES 2
chrif
Associate II
Posted on July 14, 2015 at 17:46

Hi HankB,

It seems that in CubeMx, OTG dual role is not supported. Even, if you have a look at applications related USB, you will find that there are two examples only (USB_Host and USB_Device).

Regards 

avnerg
Associate
Posted on June 05, 2016 at 16:50

Hi HankB,

I found myself in the same situation. did you find any solution for this problem? I thought about choosing device, generate the code, copy it and then generate the code for the host, using both parts and writing the code for switching them by myself.

 Hope you came across better solution.

Thanks,

Avner