AnsweredAssumed Answered

CubeMX - Full duplex communication in USB CDC

Question asked by sinitsin.artyom on Apr 24, 2015
Latest reply on Apr 25, 2015 by noobee
So, I have finally achieved sending capability over CDC USB. BUT...
I have this CDC_Receive_FS function
  * @brief  CDC_Receive_FS
  *         Data received over USB OUT endpoint are sent over CDC interface
  *         through this function.
  *         @note
  *         This function will block any OUT packet reception on USB endpoint
  *         untill exiting this function. If you exit this function before transfer
  *         is complete on CDC interface (ie. using DMA controller) it will result
  *         in receiving more data while previous ones are still not sent.
  * @param  Buf: Buffer of data to be received
  * @param  Len: Number of data received (in bytes)
  * @retval Result of the operation: USBD_OK if all operations are OK else USBD_FAIL
static int8_t CDC_Receive_FS (uint8_t* Buf, uint32_t *Len)
  uint8_t result = USBD_OK;
  int i;
  USBD_CDC_SetRxBuffer(hUsbDevice_0, &UserRxBufferFS[0]); 
  result = USBD_CDC_ReceivePacket(hUsbDevice_0);
  for (uint32_t i = 0; i < 1000000; i++);
  CDC_Transmit_FS("Hello", 5);
  for (uint32_t i = 0; i < 1000000; i++);
  CDC_Transmit_FS("Gello", 5);
  for (uint32_t i = 0; i < 1000000; i++); 
  return result;
  /* USER CODE END 7 */

As said in comments to this function, this function will block any out packet :( So, I cannot send multiple packets at this function? Only one?