Skip to main content
MSipo
Senior II
March 31, 2020
Question

I'm using STM32CubeMX Version 5.6.0 to generate code. It looks like function CDC_Receive_FS() doesn't use the Len parameter?

  • March 31, 2020
  • 1 reply
  • 914 views

It looks like function CDC_Receive_FS() doesn't use the Len parameter? Is this a bug? I just noticed that when looking through the source code.

/**
 * @brief 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)
{
 /* USER CODE BEGIN 6 */
 USBD_CDC_SetRxBuffer(&hUsbDeviceFS, &Buf[0]);
 USBD_CDC_ReceivePacket(&hUsbDeviceFS);
 return (USBD_OK);
 /* USER CODE END 6 */
}

This topic has been closed for replies.

1 reply

Duy Tran
Associate III
March 31, 2020