cancel
Showing results for 
Search instead for 
Did you mean: 

USB cable connected

donev_g
Associate II
Posted on March 15, 2016 at 11:18

Hi all,

I'm working on a device with STM32F205. The MCU does to Stop mode after 15 sec. The device has also USB (VCP) and can be connected to PC. But I don't want MCU goes to Stop mode if USB cable is connected. So my question is, how to find out that USB cabel is connected, which register (bit) from USB core to watch.

1 REPLY 1
donev_g
Associate II
Posted on March 15, 2016 at 14:45

I found the register: ''OTG_FS control and status register (OTG_FS_GOTGCTL)'' and

Bit 19 BSVLD:B-session valid

Indicates the device mode transceiver status.

0: B-session is not valid.

1: B-session is valid.

In OTG mode, you can use this bit to determine if the device is connected or disconnected.

Note: Only accessible in device mode.

Bit 18 ASVLD:A-session valid

Indicates the host mode transceiver status.

0: A-session is not valid

1: A-session is valid

Note: Only accessible in host mode.

but these bits have very strange behavior. When I connect PC to the USB (B session) the bits (18 and 19)  set to 1 and when disconnect the cable the bits get clear. When connect USB barcode reader (A session) the bits are set  and when disconnect the cable they stay set and not get clear any more. Any suggestions?