USB Descriptor Issue

Author
weehau
Starting Member
  • Total Posts : 33
  • Reward points : 0
  • Joined: 2010/03/28 02:10:50
  • Location: 0
  • Status: offline
2010/06/23 19:01:22 (permalink)
0

USB Descriptor Issue

Hi there, I am rather new to USB and currently facing some issues to get USB work.

Development Tool : PIC18 Starter Kit, MPLAB IDE
Project                  : PIC18F Starter Kit 1\Demos\USB Device - HID - Joystick 1

The original code works perfectly. The USB device is detected as a HID-Compliant Joystick Controller on PC host.

The USB properties below is obtained from USBlyzer software.

ORIGINAL USB PROPERTIES: Original_USB ...ce Device


My objective here is to modify the usb_descriptors.c so that it can clone the exact usb information from another device, as shown as below:

HONDA USB PROPERTIES :honda controller.txt


So using these information, this is the modified code :

/* Device Descriptor */    
ROM USB_DEVICE_DESCRIPTOR device_dsc=
{
    0x12,    // Size of this descriptor in bytes
    USB_DESCRIPTOR_DEVICE,                // DEVICE descriptor type
    0x0100,                 // USB Spec Release Number in BCD format    //TODO: changed to v1.1 to work around PIC32 BSTALL error
    0x00,                   // Class Code
    0x00,                   // Subclass code
    0x00,                   // Protocol code
    USB_EP0_BUFF_SIZE,          // Max packet size for EP0, see usb_config.h
    MY_VID,                 // Vendor ID
    MY_PID,                 // Product ID: Mouse in a circle fw demo
    0x0100,                 // Device release number in BCD format
    0x01,                   // Manufacturer string index
    0x02,                   // Product string index
    0x00,                   // Device serial number string index
    0x01                    // Number of possible configurations
};

/* Configuration 1 Descriptor */
ROM BYTE configDescriptor1[]={
    /* Configuration Descriptor */
    0x09,//sizeof(USB_CFG_DSC),    // Size of this descriptor in bytes
    USB_DESCRIPTOR_CONFIGURATION,                // CONFIGURATION descriptor type
    DESC_CONFIG_WORD(0x0022),   // Total length of data for this cfg
    1,                      // Number of interfaces in this cfg
    1,                      // Index value of this configuration
    0,                      // Configuration string index
    _DEFAULT | _SELF,               // Attributes, see usb_device.h
    150,                     // Max power consumption (2X mA)

    /* Interface Descriptor */
    0x09,//sizeof(USB_INTF_DSC),   // Size of this descriptor in bytes
    USB_DESCRIPTOR_INTERFACE,               // INTERFACE descriptor type
    0,                      // Interface Number
    0,                      // Alternate Setting Number
    1,                      // Number of endpoints in this intf
    HID_INTF,               // Class code
    0,  //BOOT_INTF_SUBCLASS,     // Subclass code
    0,  //HID_PROTOCOL_MOUSE,     // Protocol code
    0,                      // Interface string index

    /* HID Class-Specific Descriptor */
    0x09,//sizeof(USB_HID_DSC)+3,    // Size of this descriptor in bytes RRoj hack
    DSC_HID,                // HID descriptor type
    DESC_CONFIG_WORD(0x0100),                 // HID Spec Release Number in BCD format (1.11)
    0x00,                   // Country Code (0x00 for Not supported)
    HID_NUM_OF_DSC,         // Number of class descriptors, see usbcfg.h
    DSC_RPT,                // Report descriptor type
    DESC_CONFIG_WORD(HID_RPT01_SIZE),   //sizeof(hid_rpt01),      // Size of the report descriptor


    /* Endpoint Descriptor */
    0x07,/*sizeof(USB_EP_DSC)*/
    USB_DESCRIPTOR_ENDPOINT,    //Endpoint Descriptor
    HID_EP | _EP_IN,            //EndpointAddress
    _INT,                       //Attributes
    DESC_CONFIG_WORD(9),                  //size
    0x0A,                        //Interval
};


//Language code string descriptor
ROM struct{BYTE bLength;BYTE bDscType;WORD string[1];}sd000={
sizeof(sd000),USB_DESCRIPTOR_STRING,{0x0409
}};

//Manufacturer string descriptor
ROM struct{BYTE bLength;BYTE bDscType;WORD string[1];}sd001={
sizeof(sd001),USB_DESCRIPTOR_STRING,
{'?'}};

//Product string descriptor
ROM struct{BYTE bLength;BYTE bDscType;WORD string[19];}sd002={
sizeof(sd002),USB_DESCRIPTOR_STRING,
{'H','o','n','d','a',' ','R','S',' ','C','o','n','t','r','o','l','l','e','r'
}};

//Array of configuration descriptors
ROM BYTE *ROM USB_CD_Ptr[]=
{
    (ROM BYTE *ROM)&configDescriptor1
};

//Array of string descriptors
ROM BYTE *ROM USB_SD_Ptr[]=
{
    (ROM BYTE *ROM)&sd000,
    (ROM BYTE *ROM)&sd001,
    (ROM BYTE *ROM)&sd002
};

ROM struct{BYTE report[HID_RPT01_SIZE];}hid_rpt01={{
 
0x05,0x01,
0x09,0x04,
0xA1,0x01,
0x85,0x01,
0x09,0x30,
0x16,0xEA,0x00,
0x26,0x35,0x03,
0x36,0xDA,0x00,
0x46,0x45,0x03,
0x66,0x00,0x00,
0x75,0x10,
0x95,0x01,
0x81,0x02,
0x09,0x31,
0x16,0xAE,0x01,
0x26,0xE2,0x02,
0x36,0xBE,0x01,
0x46,0xD2,0x02,
0x66,0x00,0x00,
0x75,0x10,
0x95,0x01,
0x81,0x02,
0x09,0x32,
0x16,0xF0,0x02,
0x26,0xFF,0x03,
0x36,0xE0,0x02,
0x46,0xFF,0x03,
0x66,0x00,0x00,
0x75,0x10,
0x95,0x01,
0x81,0x02,
0x09,0x39,
0x16,0x00,0x00,
0x26,0xFF,0x00,
0x36,0x00,0x00,
0x46,0xFF,0x00,
0x66,0x00,0x00,
0x75,0x10,
0x95,0x01,
0x81,0x02,
0x85,0x02,
0x05,0x09,
0x19,0x01,
0x29,0x10,
0x15,0x00,
0x25,0x01,
0x35,0x00,
0x45,0x01,
0x75,0x01,
0x95,0x10,
0x81,0x02,
0x05,0x01,
0x09,0x33,
0x16,0xB0,0x01,
0x26,0x10,0x03,
0x36,0x90,0x01,
0x46,0x20,0x03,
0x66,0x00,0x00,
0x75,0x10,
0x95,0x01,
0x81,0x02,
0x09,0x34,
0x16,0x00,0x00,
0x26,0xFF,0x03,
0x36,0x00,0x00,
0x46,0xFF,0x03,
0x66,0x00,0x00,
0x75,0x10,
0x95,0x01,
0x81,0x02,
0x09,0x35,
0x16,0x99,0x00,
0x26,0x66,0x03,
0x36,0xA9,0x00,
0x46,0x56,0x03,
0x66,0x00,0x00,
0x75,0x10,
0x95,0x01,
0x81,0x02,
0x85,0x03,
0x06,0x00,0xFF,
0x19,0x01,
0x29,0x04,
0x25,0xFF,
0x45,0xFF,
0x75,0x08,
0x95,0x04,
0x91,0x02,
0xC0
}
};
/** EOF usb_descriptors.c ***************************************************/

HID_RPT01_SIZE = 213

#endif



You can actually see that this code slightly differs from the original usb_descriptor.c. I have modified some of the fields to match the USB properties of HONDA controller. However as this code was compiled and uploaded to PIC18 Starter kit, the host PC can't recognize the hardware, and the usb device is shown as unknown device. I really need someone to point me where my problem is. The project dateline is this week. Thanks in advance.


post edited by weehau - 2010/06/24 01:16:18
#1

14 Replies Related Threads

    weehau
    Starting Member
    • Total Posts : 33
    • Reward points : 0
    • Joined: 2010/03/28 02:10:50
    • Location: 0
    • Status: offline
    Re:USB Descriptor Issue 2010/06/23 20:15:19 (permalink)
    0
    Sorry forget to add on something.

    1. Device Descriptor
    2. Configuration Descriptor
    3. Interface Descriptor
    4. HID Descriptor
    5. EndPoint Descriptor
    6. Interface 0 HID Report Descriptor

    This unrecognized hardware issue only occured i tried to alter the Interface 0 HID Report Descriptor field. If I only change the fields of Descriptor 1 to 5 and use the same HID Report, it is able to detect as USB-HID Compliant Controller.
    #2
    weehau
    Starting Member
    • Total Posts : 33
    • Reward points : 0
    • Joined: 2010/03/28 02:10:50
    • Location: 0
    • Status: offline
    Re:USB Descriptor Issue 2010/06/24 00:34:25 (permalink)
    0
    Just to make things clear again.

    Now I have a gaming software that comes with a controller. The controller is detected as a USB HID compliant joystick on the host, and it's USB properties is saved to HONDA USB PROPERTIES.txt.

    I wanted to come out with my own hardware, and I am using PIC18 starter kit as development tool. The problem is, the gaming software couldn't find/detect my hardware even though it is detected as a HID-compliant-game controller on window.

    I have no luck also after modifying the VID/PID, . Therefore, I have decided to clone all of the usb properties of the original controller to mine. But it get even worst when window failed to recognize my hardware.

    Can somebody help here?

     
    #3
    m_gray
    Starting Member
    • Total Posts : 39
    • Reward points : 0
    • Joined: 2010/06/15 03:14:34
    • Location: Lille, France
    • Status: offline
    Re:USB Descriptor Issue 2010/06/24 02:14:36 (permalink)
    0
    Well, I can only see one cause,

    You don't mention anywhere what you are actually sending. You took the REPORT ID byte into account when calculating the endpoint size, make sure you start to send frames with the first byte set to 0x01->0x03 (REPORT ID byte), and after the axis / buttons data. Any other value would lead to failure.

    --
    Paul

    ** www.tildesign.com ** (under construction)
    ** my blog **
    #4
    weehau
    Starting Member
    • Total Posts : 33
    • Reward points : 0
    • Joined: 2010/03/28 02:10:50
    • Location: 0
    • Status: offline
    Re:USB Descriptor Issue 2010/06/24 02:38:04 (permalink)
    0
    Hmm sorry for my ignorance. I can't find any REPORT ID field in the descriptor.c. Which are you referring?
    #5
    m_gray
    Starting Member
    • Total Posts : 39
    • Reward points : 0
    • Joined: 2010/06/15 03:14:34
    • Location: Lille, France
    • Status: offline
    Re:USB Descriptor Issue 2010/06/24 02:51:10 (permalink)
    0


    *Interface 0 HID Report Descriptor* Joystick
    Item Tag (Value)                     Raw Data
    Usage Page (Generic Desktop)                 05 01
    Usage (Joystick)                     09 04
    Collection (Application)                 A1 01
        Report ID (1)                     85 01
        Usage (X)                         09 30
        Logical Minimum (234)                 16 EA 00
        Logical Maximum (821)                 26 35 03
        Physical Minimum (218)                 36 DA 00
        Physical Maximum (837)                 46 45 03
    ......


    This means that the frame you are sending should start with 0x01 if it has the described contents.

    --
    Paul

    ** www.tildesign.com ** (under construction)
    ** my blog **
    #6
    ulao
    Senior Member
    • Total Posts : 135
    • Reward points : 0
    • Joined: 2009/07/14 08:52:14
    • Location: 0
    • Status: offline
    Re:USB Descriptor Issue 2010/07/02 12:58:02 (permalink)
    0
    Think of a report id is just that, an ID. You have a joystick and its ID is 1. You have a mouse its ID is 2. This way you tell the descriptor to do things by ID.

    DATA[0] = 1;//this is a joystick
    DATA[0-7] = data;

    DATA[0] = 2;//this is a mouse
    DATA[0-7] = data;

    In other words the first byte is always the ID



    post edited by ulao - 2010/07/02 13:00:39
    #7
    chinzei
    Super Member
    • Total Posts : 2250
    • Reward points : 0
    • Joined: 2003/11/07 12:39:02
    • Location: Tokyo, Japan
    • Status: offline
    Re:USB Descriptor Issue 2010/07/03 11:17:31 (permalink)
    0

    However as this code was compiled and uploaded to PIC18 Starter kit, the host PC can't recognize the hardware, and the usb device is shown as unknown device.

    As you have USBlyzer, it'll give you a good clue of the bug.
    It's much easier than scanning the descriptors by eyes, to find uncertain bug.

    USBlyzer can trace (most of) the enumeration sequence.
    What is the first error on the USBlyzer trace, when the device is plugged in?

    Even if your device returns input reports in wrong format, it doesn't result "unknown device". Your device has problem on enumeration. Solve it first. After the device is successfully enumerated, move to the report format problem.

    Tsuneo
    post edited by chinzei - 2010/07/03 11:30:48
    #8
    weehau
    Starting Member
    • Total Posts : 33
    • Reward points : 0
    • Joined: 2010/03/28 02:10:50
    • Location: 0
    • Status: offline
    Re:USB Descriptor Issue 2010/07/04 02:19:27 (permalink)
    0
    Thank you so much m_gray,ulao and Tsuneo for your inputs. This post was started few days ago when i had the "unknown device" issue when cloning the device descriptor from Honda joystick controller to my PIC18 starter kit. Eventually I had the problem solved, and yes Tsuneo is absolutely right. Wrong report descriptor format doesn't result in "unknown device".

    The root of the problem is when I tried run the device in USB low speed(as what required in HONDA controller), but I was very sure that my configuration settings (6MHz clock) for USB Low speed was correct at that time.

    All of the time, I have been using the PIC18 starter kit pre-programmed bootloader to upload my code. Using this bootloader, I found out that my Low Speed USB program didn't run properly after successfully uploaded. The device repeatingly reset after entering the main menu for 1~2 seconds. And the device also shown as "unknown" on window.

    Next, I tried to bypass the bootloader by program the Low Speed USB code on the field using PICKit3, and the bootloader was erased from program memory. Surprisingly, my Low speed USB device was able to be recognized and the problem was solved.

    I suspect that to run low speed USB application, we have to alter the bootloader's code so that it is also running at the same speed. Correct me if I am wrong? Thanks
    #9
    weehau
    Starting Member
    • Total Posts : 33
    • Reward points : 0
    • Joined: 2010/03/28 02:10:50
    • Location: 0
    • Status: offline
    Re:USB Descriptor Issue 2010/07/04 03:32:10 (permalink)
    0
    Interface 0 HID Report Descriptor Joystick
    Item Tag (Value)                                                            Raw Data
    Usage Page (Generic Desktop)                                                05 01 
    Usage (Joystick)                                                            09 04 
    Collection (Application)                                                    A1 01     
    Report ID (1)                                                               85 01    
    Usage (X)                                                                   09 30     
    Logical Minimum (234)                                                       16 EA 00     
    Logical Maximum (821)                                                       26 35 03     
    Physical Minimum (218)                                                      36 DA 00     
    Physical Maximum (837)                                                      46 45 03     
    Unit (None)                                                                 66 00 00                    
    Report Size (16)                                                            75 10     
    Report Count (1)                                                            95 01     
    Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit)                                 81 02     
    Usage (Y)                                                                   09 31    
    Logical Minimum (430)                                                       16 AE 01     
    Logical Maximum (738)                                                       26 E2 02     
    Physical Minimum (446)                                                      36 BE 01    
    Physical Maximum (722)                                                      46 D2 02     
    Unit (None)                                                                 66 00 00     
    Report Size (16)                                                            75 10     
    Report Count (1)                                                            95 01    
    Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit)                                 81 02     
    Usage (Z)                                                                   09 32     
    Logical Minimum (752)                                                       16 F0 02   
    Logical Maximum (1023)                                                      26 FF 03     
    Physical Minimum (736)                                                      36 E0 02     
    Physical Maximum (1023)                                                     46 FF 03     
    Unit (None)                                                                 66 00 00    
    Report Size (16)                                                            75 10     
    Report Count (1)                                                            95 01    
    Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit)                                 81 02     
    Usage (Hat Switch)                                                          09 39     
    Logical Minimum (0)                                                         16 00 00     
    Logical Maximum (255)                                                       26 FF 00     
    Physical Minimum (0)                                                        36 00 00     
    Physical Maximum (255)                                                      46 FF 00    
    Unit (None)                                                                 66 00 00     
    Report Size (16)                                                            75 10     
    Report Count (1)                                                            95 01     
    Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit)                                 81 02

        

    Report ID (2)                                                               85 02     
    Usage Page (Button)                                                         05 09     
    Usage Minimum (Button 1)                                                    19 01     
    Usage Maximum (Button 16)                                                   29 10     
    Logical Minimum (0)                                                         15 00     
    Logical Maximum (1)                                                         25 01     
    Physical Minimum (0)                                                        35 00     
    Physical Maximum (1)                                                        45 01     
    Report Size (1)                                                             75 01     
    Report Count (16)                                                           95 10     
    Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit)                                 81 02     
    Usage Page (Generic Desktop)                                                05 01     
    Usage (Rx)                                                                  09 33    
    Logical Minimum (432)                                                       16 B0 01    
    Logical Maximum (784)                                                       26 10 03     
    Physical Minimum (400)                                                      36 90 01     
    Physical Maximum (800)                                                      46 20 03     
    Unit (None)                                                                 66 00 00     
    Report Size (16)                                                            75 10     
    Report Count (1)                                                            95 01    
    Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit)                                 81 02     
    Usage (Ry)                                                                  09 34     
    Logical Minimum (0)                                                         16 00 00     
    Logical Maximum (1023)                                                      26 FF 03     
    Physical Minimum (0)                                                        36 00 00     
    Physical Maximum (1023)                                                     46 FF 03     
    Unit (None)                                                                 66 00 00     
    Report Size (16)                                                            75 10     
    Report Count (1)                                                            95 01     
    Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit)                                 81 02     
    Usage (Rz)                                                                  09 35     
    Logical Minimum (153)                                                       16 99 00     
    Logical Maximum (870)                                                       26 66 03     
    Physical Minimum (169)                                                      36 A9 00     
    Physical Maximum (854)                                                      46 56 03     
    Unit (None)                                                                 66 00 00     
    Report Size (16)                                                            75 10     
    Report Count (1)                                                            95 01     
    Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit)                                 81 02

         

    Report ID (3)                                                               85 03    
    Usage Page (Vendor-Defined 1)                                               06 00 FF     
    Usage Minimum (Vendor-Defined 1)                                            19 01     
    Usage Maximum (Vendor-Defined 4)                                            29 04     
    Logical Maximum (-1)                                                        25 FF     
    Physical Maximum (-1)                                                       45 FF     
    Report Size (8)                                                             75 08     
    Report Count (4)                                                            95 04     
    Output (Data,Var,Abs,NWrp,Lin,Pref,NNul,NVol,Bit)                           91 02 
    End Collection


    DATA[0] = 1;//this is a joystick
    DATA[0-7] = data;

    DATA[0] = 2;//this is a mouse
    DATA[0-7] = data;

    In other words the first byte is always the ID



    This means that the frame you are sending should start with 0x01 if it has the described contents.



    Thank you for your input again.
    I started to explore USB only few days ago and I spent lot of time to study on it.
    I couldn't understand what you were saying but finally get some clues today.

    Now my understanding is, I have 3 reports:
    Report1 : [0x01][16 bit X][16 bit Y][16 bit Z][16 bit hat_switch]
    Report2 : [0x02][16 bit button][16 bit Rx][16 bit Ry][16 bit Rz]
    Report3 : [0x03][8 bit vendor defined 1
    ][8 bit vendor defined 2][8 bit vendor defined 3][8 bit vendor defined 4]

    So my questions here:
    1.
        In the main loop, HIDTxPacket() is called to send HID IN packets over USB to the host.
        Eg.  lastTransmission = HIDTxPacket(HID_EP, (BYTE*)&Report1, sizeof(Report1));

        Should I be sending all the 2 IN reports in every iteration of loop as each contains different information?

        Eg.
        lastTransmission = HIDTxPacket(HID_EP, (BYTE*)&Report1, sizeof(Report1));
        lastTransmission = HIDTxPacket(HID_EP, (BYTE*)&Report2, sizeof(Report2));

        Or I only need to send Report2 each time when the Buttons, Rx, Ry or Rz value's change?

    2.
        0x07,/*sizeof(USB_EP_DSC)*/
        USB_DESCRIPTOR_ENDPOINT,    //Endpoint Descriptor
        HID_EP | _EP_IN,            //EndpointAddress
        _INT,                       //Attributes
        DESC_CONFIG_WORD(9),        //size
        0x0A,                       //Interval

    I understand that the maximum size for each packet is set at 9 bytes. Can I set to any value higher than this but comply to USB Low speed standard the same time?

    Sorry for so many questions, and I will really appreciate any of you to spend 5 minutes to answer my questions.





    post edited by weehau - 2010/07/04 04:34:02
    #10
    chinzei
    Super Member
    • Total Posts : 2250
    • Reward points : 0
    • Joined: 2003/11/07 12:39:02
    • Location: Tokyo, Japan
    • Status: offline
    Re:USB Descriptor Issue 2010/07/04 05:06:40 (permalink)
    0

    The root of the problem is when I tried run the device in USB low speed(as what required in HONDA controller)

    Usually, HID PC class driver doesn't care if the device is low-speed or full-speed. When the descriptors matches to the original, the full-speed clone device works same as low-speed original. Descriptors on a low-speed device is fine for full-speed clone, without any change.

    So, you don't need to hustle to make the clone low-speed.
     

    I suspect that to run low speed USB application, we have to alter the bootloader's code so that it is also running at the same speed.

    Yes.
    Application firmware shares the configuration bits on the high address of the code space with the bootloader (*1). For low-speed application firmware, bootloader should run on the low-speed setting of the configuration bits.

    I posted low-speed HID bootloader for PIC18F46J50 PIM in this topic.

    Low-speed USB on a PIC18F46J50
    http://www.microchip.com/forums/m496489.aspx

    In this bootloader, the major changes are,
    * The configuration bits were changed to match to low-speed USB, on-chip OSC without any external crystal.
    * Input and output reports are split into 8 bytes packets, to fits to low-speed interrupt endpoints.

    (*1) Optionally, configuration bits are re-programmed by bootloader for the application firmware. But it has restrictions. 

    Tsuneo
    #11
    chinzei
    Super Member
    • Total Posts : 2250
    • Reward points : 0
    • Joined: 2003/11/07 12:39:02
    • Location: Tokyo, Japan
    • Status: offline
    Re:USB Descriptor Issue 2010/07/04 06:29:06 (permalink)
    0

    Now my understanding is, I have 3 reports: 
    Report1 : [0x01][16 bit X][16 bit Y][16 bit Z][16 bit hat_switch] 
    Report2 : [0x02][16 bit button][16 bit Rx][16 bit Ry][16 bit Rz] 
    Report3 : [0x03][8 bit vendor defined 1][8 bit vendor defined 2][8 bit vendor defined 3][8 bit vendor defined 4]

    Fine.

    On this report descriptor, the definition of the hat switch is out of MS spec, which is described on this MS page.
    http://www.microsoft.com/whdc/archive/hidgame.mspx

    But the original works with this definition. Maybe, this out-of-spec is accepted by the HID class driver ?.


    Should I be sending all the 2 IN reports in every iteration of loop as each contains different information?
    Or I only need to send Report2 each time when the Buttons, Rx, Ry or Rz value's change?

    Either will do.

    Strictly speaking, HID spec expects that
    - The default of report interval over the interrupt endpoint is infinity for joystick (*1). ie. the device sends the input report just when any change on the report fields occurs.
    - The host specifies the report interval for each report ID using Set_Idle request.

    But Windows (and Linux, MacOSX also) accept repeated extra reports, which are same as the last one. OS driver just ignores these extra reports, for keyboard/mouse/joystick.


    (*1) HID spec describes on this issue as follows.
    7.2.4 Set_Idle Request (HID1_11.pdf)
    The recommended default idle rate (rate when the device is initialized) is 500
    milliseconds for keyboards (delay before first repeat rate) and infinity for
    joysticks
    and mice.


    I understand that the maximum size for each packet is set at 9 bytes. Can I set to any value higher than this but comply to USB Low speed standard the same time?

    The 9 bytes of wMaxPacketSize on the endpoint descriptor is out of spec for low-speed device. It should be less than 8 bytes. It's a good reason that OS rejects the device. So, confirm if it's really this figure or not.
    Or, is the original actually low-speed device ?

    For full-speed device, 9 bytes has no problem.

    Tsuneo
    post edited by chinzei - 2010/07/04 06:55:30
    #12
    weehau
    Starting Member
    • Total Posts : 33
    • Reward points : 0
    • Joined: 2010/03/28 02:10:50
    • Location: 0
    • Status: offline
    Re:USB Descriptor Issue 2010/07/04 06:57:42 (permalink)
    0
    Hi Tsuneo,

    I appreciate your time for answering my questions.



    The 9 byte of wMaxPacketSize on the endpoint descriptor is out of spec for low-speed device. It should be less than 8 bytes. It's a good reason that OS rejects the device. So, confirm if it's really this figure or not.
    Or, is the original actually low-speed device ?

    For full-speed device, 9 bytes has no problem.

    Tsuneo




    Yup, I can confirmed that Honda device is low-speed usb device, unless USBlyzer is giving me fake information. I have no problem to copy these fields into PIC18 starter kit and get enumerated successfully by the HOST. If I set the wMaxPacketSize to less than 8, I guess some data in the reports will be dropped, as Report1 and Report2 is already 9 bytes each. Am I right? Please refer to my post#1 for honda controller.txt. It is clearly stated in the file that it is Low-speed and 9 bytes of wMaxPacketSize.

    *Connection Status***               Device connected
    *Current Configuration***           1
    *Speed***                           Low
    *Device Address***                  1
    *Number Of Open Pipes***            1


    *Endpoint Descriptor 81* 1 In, Interrupt, 10 ms
    Offset    Field                     Size      Value    Description
    0         bLength                   1         07h    
    1         bDescriptorType           1         05h     Endpoint
    2         bEndpointAddress          1         81h     1 In
    3         bmAttributes              1         03h     Interrupt
                 1..0: Transfer Type         ......11     Interrupt
                 7..2: Reserved              000000..     
    4         wMaxPacketSize            2         0009h   9 bytes
    6         bInterval                 1         0Ah     10 ms



    I believe that Tsuneo's statement is correct based on his profound understanding of USB. What confused me is that if these data fields are out of spec, how can the device get enumerated successfully from the host? Somebody please clarify. Thanks.

    #13
    chinzei
    Super Member
    • Total Posts : 2250
    • Reward points : 0
    • Joined: 2003/11/07 12:39:02
    • Location: Tokyo, Japan
    • Status: offline
    Re:USB Descriptor Issue 2010/07/04 08:06:27 (permalink)
    0

    What confused me is that if these data fields are out of spec, how can the device get enumerated successfully from the host?

    When you go out of spec, it doesn't mean the device doesn't work immediately. It still works on some PC on some OS version. But it isn't guaranteed to work on all of PC and all of OS version.

    Vista and Windows 7 check the wMaxPacketSize for low-speed device, and these OS version reject the device.

    It's similar to overclocking of PC. Some PC works, but not for every PC.

    As you are making your personal project, you can do the out of specs, as long as it works on YOUR PC. In this case also, it's better to know that you are doing out-of-spec.
    For production, follow the spec strictly.


    If I set the wMaxPacketSize to less than 8, I guess some data in the reports will be dropped, as Report1 and Report2 is already 9 bytes each.

    To send a report greater than wMaxPacketSize, the device splits the report into 2 or more packets.

    Tsuneo
    #14
    ulao
    Senior Member
    • Total Posts : 135
    • Reward points : 0
    • Joined: 2009/07/14 08:52:14
    • Location: 0
    • Status: offline
    Re:USB Descriptor Issue 2010/07/12 15:32:21 (permalink)
    0
    I send more then 8 like so

     while (!usbInterruptIsReady()) usbPoll();
                usbSetInterrupt((void *)&reportBuffer + 0, 8);
                 while (!usbInterruptIsReady()) usbPoll();
                usbSetInterrupt((void *)&reportBuffer + 8, 5);

    #15
    Jump to:
    © 2017 APG vNext Commercial Version 4.5