This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Small question about HID USB device

Hi

I'm using USB HID library to implement an small HID device.
I already have read this library and USB 1.1 specification, but I still have a small problem.
I still cannot understand relation between 3 sizes in descriptor:
1- EP0 packet size(that you can specify in usbcfg.h)
2- Endpoint's wMaxPacketSize
3- maximum size of reports

In my case, I need to transfer 128 bytes of data to and from device. Then I have defined my reports like this:
ReportSize(8)
ReportCount(128)
But I still cannot get how wMaxPacketSize and EP0 packet size are related to these values.
From some samples, I saw that people set wMaxPacketSize to 64. But how I should transfer my reports if wMaxPacketsize is 64? or are they related at all?

Regards

Parents
  • wMaxPacketSize of the interrupt IN (or OUT) endpoint determines the division unit of the report.
    For full-speed device, wMaxPacketSize is limited to less than or equal to 64 bytes.
    For low-speed, it's 8 bytes.

    When the report size is greater than wMaxPacketSize, the report is split into packets of wMaxPacketSize. For example, 128 bytes report is divided into two 64 bytes packets. And then, these packets are exchanged one packet by one over the interrupt endpoint.
    I'm not sure which HID example you are starting on.
    In most examples, you have to code it so that above division works.

    bMaxPacketSize of the default endpoint (EP0) also determines the division unit of the transfer.
    For HID reports, this value affects to the report exchange using Get_Report and Set_Report() requests.
    Usually in most examples, the USB firmware stack cares it for you.

    Tsuneo

Reply
  • wMaxPacketSize of the interrupt IN (or OUT) endpoint determines the division unit of the report.
    For full-speed device, wMaxPacketSize is limited to less than or equal to 64 bytes.
    For low-speed, it's 8 bytes.

    When the report size is greater than wMaxPacketSize, the report is split into packets of wMaxPacketSize. For example, 128 bytes report is divided into two 64 bytes packets. And then, these packets are exchanged one packet by one over the interrupt endpoint.
    I'm not sure which HID example you are starting on.
    In most examples, you have to code it so that above division works.

    bMaxPacketSize of the default endpoint (EP0) also determines the division unit of the transfer.
    For HID reports, this value affects to the report exchange using Get_Report and Set_Report() requests.
    Usually in most examples, the USB firmware stack cares it for you.

    Tsuneo

Children