AnsweredAssumed Answered

Why CDC_Receive_FS is empty on usbd_cdc_if.c?

Question asked by elgarbe on Sep 2, 2015
Latest reply on Sep 15, 2015 by elgarbe
Hi, I create a new project using cubemx 4.10 with hal 1.8 for USB device. I'm looking for receive function and i found CDC_Receive_FS, but there is almost no code in ther:
/**
  * @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)
{
  /* USER CODE BEGIN 6 */
  return (USBD_OK);
  /* USER CODE END 6 */
}

when the host send a byte an IRQ is generated and end on this function, right? On Buf I have byte receive and on Len the lenght of it. What is the link between that lenght and the define:
/* Define size for the receive and transmit buffer over CDC */
/* It's up to user to redefine and/or remove those define */
#define APP_RX_DATA_SIZE  4
#define APP_TX_DATA_SIZE  4

as soon as the host send a byte the CDC_Receive_FS will run? or it has to be APP_RX_DATA_SIZE bytes before CDC_Receive_FS will call?

thank!

Outcomes