cancel
Showing results for 
Search instead for 
Did you mean: 

how to check usb cable is connected with many devices?

jeff.lee
Associate III

hello,

i want to check usb cable is connected . below code is ok with one device which is used with stm32L4xx chip.

static int8_t CDC_Init_FS(void)

{

 /* USER CODE BEGIN 3 */

 //jeff: check the usb cable connect

  if(hUsbDeviceFS.dev_state == USBD_STATE_CONFIGURED)

  {

   usbCable_connected = 1;

  }

 hUsbDevice_0 = &hUsbDeviceFS;

 /* Set Application Buffers */

 USBD_CDC_SetTxBuffer(&hUsbDeviceFS, UserTxBufferFS, 0);

 USBD_CDC_SetRxBuffer(&hUsbDeviceFS, UserRxBufferFS);

 return (USBD_OK);

 /* USER CODE END 3 */

}

however, when i connect to usb port with three device , above code is not work.

it means that one device is checking ok, but second device is not detected with above code. not detect usb cable connect.

please give me somebody answer.

thanks a lot.

1 REPLY 1

I don't quite understand what are you trying to accomplish. One USB cable can be connected only to one USB device (and on the other end, one USB host).

JW