Main Site Documentation

USB Endpoint wMaxPacketSize - constrained to 64 bytes?


#1

I’ve noted the FEZ Panda II won’t start successfully if I increase a USB clients endpoint beyond 64 bytes.
Is this a hardware constraint?
Does it apply to all GHI modules?

I also noted that by client app sometimes stalls when sending the FEZ 64 bytes. If I send just a few bytes less than the max packet size, all works perfectly. Any ideas?

Cheers
mark


#2

What exactly are we talking about? Maybe code will explain what you mean better.

If understand you correctly, USB1.1 specifications sets the size to 64 bytes so it is impossible to make it higher


#3

[quote]I also noted that by client app sometimes stalls when sending the FEZ 64 bytes. If I send just a few bytes less than the max packet size, all works perfectly. Any ideas?
[/quote]
Are you using CDC or USB client directly?
Are you using latest firmware?


#4

I am using USB client directly. I didn’t know USB 1.1 has a max size of 64 bytes.

Yes, I am using the latest firmware.


#5

If sending a multiple of 64, you have to send an empty packet. Otherwise, the computer will think there are more data to come.


public int Write(byte[] buffer, int offset, int count)
{
    int total = stream.Write(buffer, offset, count);

    // Write empty packet if multiple of 64
    if(total % 64 == 0)
        stream.Write(buffer, 0, 0);

    return total;
}


#6

You mention sending a multiple of 64.

Does that mean I can send/read data larger than max packet size - does USB automatically break it into smaller packets?

So is it legal to say send 300 bytes at once?

Thanks for the hint. I wouldn’t have figured it out so fast :slight_smile:


#7

Yes, it is automatic. It will be broken down…