Does anyone know how I can detect if my USB device is connected to a Host or not?
Thx Steven
sure! IC8 in the schematic is an USBLC6-4 use a WE-TVS instead. As you can see on the datasheet(katalog.we-online.de/.../824014.pdf) they have an extra diode on pin 5 in reverse direction to VDD. If now D+ is high on IC8 pin 3 it doesn't feed back to VBUS_FS which is connected to the USB detection pin PA9.
Cheers!
Great, thanks for detailed explanation I hope somebody having same issue in future will value this :-)
So with mentioned hardware changes + adding definition USBD_VBUS_DETECT=1 for driver solves problem of connect/disconnect detection.