Hi
What is the particular endpoint size? CDC receivers tends to queue received data and pass it to the application only after receiving a frame of less that the endpoint size (in a similar way that control endpoints use a non-full size frame to detect the end of a control block - including zero data frame).
In the uTasker project CDC bulk endpoints are defined with a flag (USB_ENDPOINT_TERMINATES) that automatically terminates with a zero length data frame as follows in case the transmitted size happens to complete with a full-length data packet. If you can identify a similar location in the NXP stack (when it knows that the application has not queued further data for transmission) you could add a similar endpoint control flag to do the same.
if (ptrUsbQueue->USB_queue.chars == usNonAcknowledged) { // no further data waiting in the output buffer which has not already been placed in the output FIFO buffers
if (ptrUsbQueue->USB_queue.chars == 0) { // no more data queued
if (fnControlEndpoint(iEndpoint, iChannel, (USB_CONTROL_ENDPOINT | USB_ENDPOINT_TERMINATES)) != 0) { // if the endpoint is a control end point (or has termination characteristics) send zero data on termination if last frame was the same length as the endpoint
if ((tx_queue->usCompleteMessage % tx_queue->usMax_frame_length) == 0) {
FNSEND_ZERO_DATA(ptrUSB_HW, iEndpoint); // send a zero frame to terminate status stage
usNonAcknowledged = 1; // ensure that the transmitter state is not deactivated yet
}
}
....
Regards
Mark
[uTasker project developer for Kinetis and i.MX RT]
Contact me by personal message or on the uTasker web site to discuss professional training, solutions to problems or product development requirements