2023-12-14 11:51 AM - edited 2023-12-14 11:52 AM
Hello,
I've enabled a USB virtual com port on an STM32F373 successfully. The CDC_Receive_FS function in usbd_cdc_if.c gets called when data is received. I never expect to never receive a 'packet' greater than 64 bytes and have created my USB buffer[64] variable accordingly.
My questions is can I ever expect CDC_Receive_FS to be called more than once in some cases, even if the sender is always transmitting a 'packet' less than 64 bytes? I know my UART RX callback sometimes gets called more than once, with the 'packet' split into 2 callbacks. Will CDC_Receive_FS act the same way or can I rest assured *Len will always equal the exact number of bytes transmitted by the sender in 1 'packet'?
I currently consider anything sent between 'idle' times of 1 byte or more to be a 'packet'.
Thank you
2023-12-14 01:00 PM
I already explained this there:
And now you also explained it yourself:
I currently consider anything sent between 'idle' times of 1 byte or more to be a 'packet'.
So can you understand yourself - what an "anything ... of 1 byte or more" means? It's a stream of bytes, not messages. The callback can be called even after every single byte! And it doesn't matter what packets the sender is sending, because the stream interfaces have no concept of messages at API level and therefore the sender application also doesn't have a control over what sized packets the system will send.
2023-12-14 01:06 PM - edited 2023-12-14 01:08 PM
I do see your previous post, thank you for confirming.