cancel
Showing results for 
Search instead for 
Did you mean: 

How can I send interrupt command via CDC in STM32?

nortowianski
Associate II
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?

1 REPLY 1
sxiao.11
Associate

Do you solve it? I have the same problem.