2022-10-11 06:59 AM
I want to programme a USB host CDC. This works as far as it goes.
This means I can receive and send data.
My problem is that the receive interrupt is called 2 times for data packets with 64 bytes.
It is also always called once too often for packets >64 bytes. This means that it is called 3 times for 128 bytes.
The result is that I always receive the last packet 2 times.
Has anyone already observed this problem?
Best regards
Snumeli
2022-10-11 08:15 AM
This is the normal behavior of USB CDC class. CDC host or device must send a zero-length packet (ZLP) to complete every n*ENDPOINT_SIZE bytes long payload data, otherwise the transfer of data is considered to be in progress (not finished). ST USB CDC stack neither filters out the incoming ZLPs nor it emits the ZLPs when they are required. CDC_Receive must check for zero length.