AnsweredAssumed Answered

How can I send interrupt command via CDC in STM32?

Question asked by ntow on Feb 12, 2018

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?