AnsweredAssumed Answered

USB double buffered endpoint question

Question asked by stokic.srdjan on Jul 14, 2016

I have a CDC working with a double buffered endpoint. Everything seems fine, but I was wondering about the following situation.

When I transfer a block of data, and the last piece is <64 bytes, shouldn't the transfer terminate automatically? Instead, I see one more call to a USB interrupt (for the other buffer), and since there is no data to send, I'm sending a ZLP. After this, the transfer stops.

Even if I don't send ZLP, the data will be transferred correctly, but this extra interrupt call will be executed nonetheless.

My questions is what is the proper way to terminate the data transfer with double buffered EP?  Should I send or not this extra ZLP after a short packet, or should I just ignore this extra interrupt execution?

Also, should I call FreeUserBuffer() after this last packet or not?

Thank you,