cancel
Showing results for 
Search instead for 
Did you mean: 

CTS signal on USB CDC

wjandsq
Associate III

To follow up this thread, CTS signal on USB CDC - STMicroelectronics Community

I'm experiencing a similar issue.

USBser.sys  have some problem

1. Only DTR Break can control alone

you can set  DTR is 1  or 0,  but  RTS have change,RTS only change with DTR.

2.  CDC Serial State

I  have test this code,  it  send from Endpoint 81h successfully,  but  PC USB Host  have no message

CDC_IN_Buf[0] = 0xA1; /* bmRequestType 0xA1 (10100001B)   */
CDC_IN_Buf[1] = 0x20; /* 0x21     (SERIAL_STATE)  */
CDC_IN_Buf[2] = 0x00; /* wValue   LowByte */
CDC_IN_Buf[3] = 0x00; /* wValue  HiByte */
CDC_IN_Buf[4] = 0x00; /* wIndex  LowByte  Default 0 */
CDC_IN_Buf[5] = 0x00; /* wIndex  HiByte */
CDC_IN_Buf[6] = 0x02; /* wLength  LowByte  Serial State Length  0x0002 */
CDC_IN_Buf[7] = 0x00; /* wLength  HiByte */
CDC_IN_Buf[8] = 0x14; /* Data       LowByte    */
CDC_IN_Buf[9] = 0x00; /* Data       HiByte  */
/*
CDC Serial State bit define (USB CDC 1.1  6.3.5 )
bit0  bRxCarrier     0x01
bit1  bTxCarrier      0x02
bit2  bBreak           0x04
bit3  bRingSignal    0x08
bit4  bFraming        0x10
bit5  bParity            0x20
bit6  bOverRun       0x40
*/
USBD_CDC_SetTxBuffer(&hUsbDeviceFS, CDC_IN_Buf, 10);
USBD_LL_Transmit(&hUsbDeviceFS, CDC_CMD_EP, CDC_IN_Buf, 10);
 
Only CH341/FT232RL  can have  usb serial state notify ?
 
3.  Does ST have no technology? They can't write a single driver and can only use Microsoft's CDC driver。
 
 
14 REPLIES 14
/**
  * @brief  USBD_CDC_Setup
  *         Handle the CDC specific requests
  * @PAram  pdev: instance
  * @PAram  req: usb requests
  * @retval status
  */
static uint8_t USBD_CDC_Setup(USBD_HandleTypeDef *pdev,
                              USBD_SetupReqTypedef *req)
{
  USBD_CDC_HandleTypeDef *hcdc = (USBD_CDC_HandleTypeDef *)pdev->pClassDataCmsit[pdev->classId];
  uint16_t len;
  uint8_t ifalt = 0U;
  uint16_t status_info = 0U;
  USBD_StatusTypeDef ret = USBD_OK;

  if (hcdc == NULL)
  {
    return (uint8_t)USBD_FAIL;
  }

  switch (req->bmRequest & USB_REQ_TYPE_MASK)
  {
    case USB_REQ_TYPE_VENDOR:   /* 0x40 Request from vendor  */
#if defined(USE_CH340_DRIVER)
      CH340_Requset_Handle(pdev, hcdc, req);
#elif defined(USE_FTDI_DRIVER)
      FT232RL_Requset_Handle(pdev, hcdc, req);
#endif
      break;
    case USB_REQ_TYPE_CLASS:    /* 0x20  CDC HID UVC UAC BOT Request */
      ...

1. RTS / DTR  is use Control the other STM32 MCU Boot0/Reset pin.

2. Serial Status Notify is use PC Software the USB Device is wake or Data Package is read for transfer.

None of these ST  have been implemented

 

wjandsq
Associate III

RTS is not used for flow control. RTS is used to control the Boot0 of a third-party STM32 MCU.
DTR is used to control the RESET of a third-party STM32 MCU.

Serial port status notifications are used to inform the PC software that it is ready to receive packet data transmission from the USB CDC device, which is at a lower level than protocols like YModem.

RTS is not used for flow control. RTS is used to control the Boot0 of a third-party STM32 MCU.
DTR is used to control the RESET of a third-party STM32 MCU.

Serial port status notifications are used to inform the PC software that it is ready to receive packet data transmission from the USB CDC device, which is at a lower level than protocols like YModem.

 

Currently using the CH340 driver, the RTS control issue and the problem of reporting serial port status notifications to the PC host have been resolved. ST's driver is helpless with these two issues.

Thank you @wjandsq for explanation of your use case. Hope someone from ST can follow up.