Sounds right. As long as the enumeration succeeds in setting up the EPs MPS. To send a 512 bytes of data it will take 2 packets. A zero length packet or a less than max size packet says to the other end that this is the completion of the transaction. Its at USB 2.0 doc "Ch 5.8.3 Bulk Transfer Packet Size Constraints".
I got some clarificati "It all depends on how the transfer is set up. If the transfer is of known size (e.g. if the length has been previously communicated by a class-specific command either via ep.0 or a bulk endpoint) then the ZLP is not mandated. On the other hand, if a transfer has been set up speculatively, then the sending end can cause an early termination by sending a short packet. "
But, I also found another weird thing on Linux USB host driver: I have tried to send a 512-byte data from Linux USB Host, but it wouldn't send out extract 512-bytes data via bulk OUT EPs. Instead, it sent out 511 bytes when I requested to send 511 bytes or 513 bytes,
512 transmitted data with one byte null data "0x00," when I requested to send 512 bytes. Does anybody know why?
As Roger says above, it probably depends on the class of device you have enumerated (is it CDC, HID, MSD .....???) and what configuration/ capabilities the USB client enumerates itself with. My guess is that your client enumerates with a bulk OUT EP that has transfer size "speculatively" setup. My understanding is that even with "known transfer size" EP, you can get ZLP or short packets depending on the USB class our client device uses (eg: HID). Please correct me if I am wrong, because I dont want to read through the USB spec again if I dont have to !!! It is a dry read indeed :).
ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here.
All logos and trade names are the property of their respective owners.