2018-02-21 01:51 AM
Hello everyone! I'm trying to send a SERIAL_STATE notification to the host.
The example was raised earlier
https://community.st.com/message/89959
.When sending a buffer to CDK_CMD_EP, with USB_LL_Transmit the device stops responding. If I for example send a buffer to CD_OUT_EP or CDC_IN_EP, the data is sent and I can see them in the terminal.
Someone can already implemented the similar?
Thank you very much, waiting for your answers.
uint8_t CDC_Serial_State_Buf[10] = {
0xA1, // vmRequestType
0x09, // SERIAL_STATE
0x00, // wValue
0x00,
0x00, // wIndex
0x00,
0x00, // wLength
0x01,
0x00, // UART state bitmap
0x00,
};
uint8_t CDC_Serial_State(void)
{
USBD_CDC_HandleTypeDef *hcdc = (USBD_CDC_HandleTypeDef*)hUsbDeviceFS.pClassData;
if (hcdc->TxState != 0)
{
return USBD_BUSY;
}
hUsbDeviceFS.ep0_state = USBD_EP0_STATUS_IN;
hUsbDeviceFS.ep_in[0].total_length = 10;
hUsbDeviceFS.ep_in[0].rem_length = 10;
/* Start the transfer */
USBD_LL_Transmit (&hUsbDeviceFS, CDC_CMD_EP, CDC_Serial_State_Buf, 10);
HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_5);
return USBD_OK;
}�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?
#stm32f105 #vcp #serial_state #stm32-virtual-com-port #usb-cdc-serial_state