I have STM32f107 MCU soldered on custom board. I would like to use USB peripheral in CDC mode. I connected pins PA11 (D-), PA12 (D+) and GND directly to a USB cable which leads to the computer. The device is self-powered, thus I don't use VDD pin.
In STM32Cube I created a new project, configured only USB_OTG_FS device and USB_DEVICE in middleware section. Also I configured High-Speed Clock in RCC section so that USB peripheral has 48 MHz clock.
Then I generated the program skeleton and uploaded it to the MCU. Unfortunately it does not work. I think the main problem is that there is no voltage on D+ pin so that the computer is not able to recognize a new device. When I execute the
CDC_Transmit_FS function, the processor falls into the Hard fault.
The strangest thing is that when I configure STM32F429 MCU on Discovery kit in the similar way, the USB works out of the box. I tried to diff the source code, but I haven't found any crucial difference (except the STMF4 MCU uses USB High speed OTG in full speed mode).
Please does anybody have some experience on using USB with STM32F107 and STM32CubeMX program skeleton?
EDIT: When I run the MCU in bootloader mode, the D+ line is pulled to 3V3 - therefore I think the MCU really does not need any external pull-up (also datasheet says this).
EDIT2: Does anybody know what Activate VBUS option in CubeMX exactly do? I can understand it in Host mode, but what does it do in Device-Only mode?