How many packet to transfer 512 bytes in a bulk IN EP from device with MPS = 512?

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
Hi,

Could anybody answer my question: How many packet to transfer 512
bytes in a bulk IN EP from device with MPS = 512?

I thought it requires 2 packets, one 512 and the other zero-length
packets, doesn't it?

Is this written in USB 2.0 specification? I tried to search related
topic in spec but couldn't find it.

Thanks in advance.


Cuthbert

Re: How many packet to transfer 512 bytes in a bulk IN EP from device with MPS = 512?
Quoted text here. Click to load it

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".

Re: How many packet to transfer 512 bytes in a bulk IN EP from device with MPS = 512?
Quoted text here. Click to load it


Thanks for the reply, Janaka.

I got some clarification from USB-IF fourm.

Roger Fiander said:

"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?

Thanks,
Cuthbert

Re: How many packet to transfer 512 bytes in a bulk IN EP from device with MPS = 512?
Quoted text here. Click to load it

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 :).

Site Timeline