Please share more details on the buffers that you created. How many buffers are you using. I can understand that the buffer size as 16KB.
Actually, we have reference code that sends a full packet followed by a short packet and also for sending a full packet followed by a ZLP. You can find this code as attachment to the following application note:
The code attached to the above application note will be a good starting point for your project development.
Also please let me know the reason behind sending a ZLP after 1KB data.
If you want to just send 1KB of data then assert both PKTEND# and SLWR# simultaneously. Then it should commit just 1KB of data (short packet) to USB.
Please try this and let me know the result.
You can also do this by changing the buffer size to 1KB. But it will reduce the data rate if you are doing bulk data transfers.
After i did it , Pc received nothing when buffer size is 16kB, but received 1kB when buffer size is 1KB.
The same is when i want to send nkB (smaller than 16KB), buffer size must be set as 1KB.
I want to know when to use ZLP.
If the buffer size is 16KB, what ' s the size of data to send when ZLP must be asserted?