Skip to main content
Visitor II
March 31, 2020
Question

STM32 USB CDC receiving more than 64 bytes

  • March 31, 2020
  • 6 replies
  • 5040 views

Hello,

I am using the USB CDC of NUCLEO-F767ZI board. MY firmware can transmit and receive OK through the USB CDC. However, I cannot receive more than 64 bytes, only the first 64 bytes are received. The transmission is OK, it can send more than 64 bytes.

I tested with Hercules, Tera Term, Putty and the results are the same.

Do you have any idea what I missed or did I do anything wrong?

Thanks and best regards,

Duy

    This topic has been closed for replies.

    6 replies

    Super User
    March 31, 2020

    Same issue as in this question. Looks like bug.

    -- pa

    Duy TranAuthor
    Visitor II
    March 31, 2020

    Still debugging but no idea why. I tried different COM port software also.

    Technical Moderator
    April 2, 2020

    Hello,

    Which firmware package are you using ?

    I will raise this internally for check and come back to you soon.

    Best Regards,

    Imen

    Duy TranAuthor
    Visitor II
    April 2, 2020

    Hello Imen,

    Thanks for your feedback, I am using STM32Cube_FW_F7_V1.16.0.

    Best regards,

    Duy

    Technical Moderator
    April 2, 2020

    Could you please use the provided USB CDC application available on the Firmware package ? we are not expecting to run into this issue using cube firmware.

    Then, please keep us about your progress on this.

    Duy TranAuthor
    Visitor II
    April 2, 2020

    I don't see any example using CDC alone for the Nucleo-F767ZI. If possible, can you provide me the one you are testing?

    Thanks.

    Technical Moderator
    April 2, 2020

    You may get inspired and re-use sections from the CDC example available on Eval project.

    Are you using STM32CubeMX in your own project ?

    Duy TranAuthor
    Visitor II
    April 6, 2020

    Yes I am using STM32CubeMX and STM32CubeIDE in my project, still porting the example and make it run on my Nucleo.

    Technical Moderator
    April 6, 2020

    Hi @Duy,

    Please share your ioc file, this will help our CubeMX team to check and analyze your issue.

    Best Regards,

    Imen

    Duy TranAuthor
    Visitor II
    April 7, 2020

    Hello Imen,

    Thanks for your offer, it is so kind of STMicro Support team.

    Please see attached file.

    Thanks and best regards,

    Duy

    Technical Moderator
    April 9, 2020

    Hello,

    We confirm that the issue on STM32CubeMx side.

    The function CDC_Receive_FS() doesn't use the Len parameter:

    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 */
    }

    So, using USB CDC cannot receive more than 64 bytes and only the first 64 bytes are received.

    This issue is raised internally for fix.

    Best Regards,

    Imen

    Duy TranAuthor
    Visitor II
    April 10, 2020

    Hello Imen,

    Thanks for your feedback. BTW, will it be available in the next version of SDK?

    Will there any temporary fix at the moment?

    Best regards,

    Duy

    Technical Moderator
    April 10, 2020

    Hello @Duy Tran​ ,

    Sorry Duy Tran, after more investigation with CubeMx team, it appears that it's no a bug inside CubeMx tool:

    static int8_t CDC_Receive_FS(uint8_t* Buf, uint32_t *Len)

    as it's made a callback reception from the stack and the data received is in Buf, the length of the data is in Len, So, it's up to the user to use it.

    So, this is a pure CubeMx generation, and CubeMX gives just and entry point and can't

    generate the full application, the Core code of CDC_Receive_FS() is

    well protected by user tags, this can not be considered as a generation issue.

    So it is up to you to complete, change the application code.

    Best Regards,

    Imen

    Best Regards,

    Imen