2014-06-10 12:05 AM
Hi all,
I'm modifying the VCP demo for STM32F207 to work without VBUS sensing, just using D+/D- for USB communications. As stated in RM0033 (page 935/1334 Doc ID 15403 Rev 5, chapter 29.5 USB peripheral): �The VBUS pin can be freed by disabling the VBUS sensing option. This is done by setting the NOVBUSSENS bit in the OTG_FS_GCCFG register. In this case the VBUS is considered internally to be always at VBUS valid level (5 V).�
So I modified my
usb_conf.h
and commented the line&sharpdefine VBUS_SENSING_ENABLED
Code is perfeclty working on STM3220G evaluation board, but the same code loaded on our board does not work: device is not detected and inspecting USB_OTG_dev variable revelas that device does not change its status from the initial one.
I'm using USB FS, and the only difference between STM3220G board and our board is that PA9 pin is tied to VBUS only on STM3220G, while our board leaves it unconnected.
My question is: as VBUS is not sensed, how the USB peripheral detects host enumeration and exits the initialization state to become fully operative?
Thanks in advance, Stefano #usb-self-powered-devices-vbus #stm32-usb-device2014-06-12 12:05 AM
Maybe I found the solution...
VBUS monitoring is not mandatory only for USB powered devices. For self powered devices, there is no way to detect cable connection/disconnection other than monitoring VBUS pin. Check alsohttp://www.lpcware.com/content/forum/vbus-input-required-device-mode
. So now we have to manually detect VBUS presence, wiring VBUS to a free port and checking presence by reading pin value. My question is: when we detect VBUS present or missing, do we only need to callUSBD_DCD_INT_fops->DevConnected (pdev);
USBD_DCD_INT_fops->DevDisconnected (pdev); as the library would normally do when automatically monitoring VBUS, or there are also other actions that must be performed (i.e. turning on/off the pull-up resistor on D+) ? Thanks in advance, Stefano2014-07-28 08:43 AM
Have you managed to do it?
The reference manual says ''B-VBUS sensing enable (GCCFG/VBUSASEN)It switches on/off the VBUS comparators associated with B-device operations. It must beset when in B-device (USB peripheral) mode and during HNP.''So I guess it always has to be set when using the usb this way manual vbus sensing is not possible, is it?2014-07-28 09:51 AM
VBUS disable(HOST mode):
//#define VBUS_SENSING_ENABLED .... /* configure charge pump IO */ //USB_OTG_BSP_ConfigVBUS(pdev); /* Restart the Phy Clock */ ..... // enable disable the external charge pump //USB_OTG_BSP_DriveVBUS(pdev, state); // Turn on the Host port power.2014-08-29 06:12 AM
Hi krueger.thomas.
I think the code you posted is related to an OTG host device. I don't need to turn on external VBUS power, as I'm creating an USB device, not an USB host. And even if I comment VBUS_SENSING_ENABLED as you wrote, the only way to have the device enumerated and recognized by PC is to connect VBUS to PA9. In fact if you look deeper in reference manual as reported by Václav, the USB peripheral state always use VBUS to change its internal status, so it's not possible to switch the internal state machine manually.2015-02-25 06:42 AM
#define VBUS_SENSING_ENABLED
as you have suggested in your first post. However, as you also mentioned,USBD_DCD_INT_fops->DevConnected (pdev);
USBD_DCD_INT_fops->DevDisconnected (pdev);are never called without VBUS sense, so when connected to the PC it just results in an 'unknown device'. I'm guessing the library needs to be hacked a bit... but not sure where to start. The interesting thing is that when BOOT0 is held high at power on, the micro successfully goes into bootloader mode (DFU) and connects properly with the PC. In this case, maybe the bootloader code sets it up as a USB host? If it is set up as a USB Device, then it must be possible to for us to do it as well...Any info about what you ended up doing would be greatly appreciated! Thanks!Tim