Skip to main content
nortowianski
Associate II
February 12, 2018
Question

How can I send interrupt command via CDC in STM32?

  • February 12, 2018
  • 1 reply
  • 695 views
Posted on February 12, 2018 at 08:18

CDC has 3 endpoints (IN, OUT and Interrupt). I have no problem with sending messages via IN and OUT (bulks), but there is a problem when I try use interrupt endpoint (0x82).  I created similar method to USBD_CDC_TransmitPacket, but using interrupt endpoint:

uint8_t CDC_Transmit_Cmd(uint8_t* Buf, uint16_t Len) { uint8_t result = USBD_OK; /* USER CODE BEGIN 7 */ USBD_CDC_HandleTypeDef *hcdc = (USBD_CDC_HandleTypeDef*)hUsbDeviceFS.pClassData; if (hcdc->TxState != 0){ return USBD_BUSY; } result = USB_Transmit_Cmd(&hUsbDeviceFS, Buf, Len); /* USER CODE END 7 */ return result; }

uint8_t USB_Transmit_Cmd (USBD_HandleTypeDef *pdev, uint8_t *report, uint16_t len) { USBD_CDC_HandleTypeDef *hcdc = (USBD_CDC_HandleTypeDef*)pdev->pClassData; if(pdev->pClassData != NULL) { if(hcdc->TxState == 0) { /* Tx Transfer in progress */ hcdc->TxState = 1; USBD_LL_Transmit (pdev, CDC_CMD_EP, report, len); } } return USBD_OK; }

I don't see any messages in USBLyzer. Did anyone use interrupt endpoint in CDC?

    This topic has been closed for replies.

    1 reply

    sxiao.11
    Associate
    December 19, 2018

    Do you solve it? I have the same problem.