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

No HID interrupt IN transfers

Hi,

For a LPC23xx device, I'm adding HID besides MSC. I got everything working fine, except for HID interrupt IN transfers. So I can get and set HID reports via control transfers. Also, I can set reports via interrupt OUT transfers, but not IN.

Using USBlyzer, I diagnosed the packet stream. As soon as I attach my device, I do see two interrupt IN transfer attempts at 01:00:81 (C:I:E). If my host application reads EP 1, USBlyzer does not show any packets passing by.

I'm a bit out of options. Does anyone have a clue where to look for a fix?

Thanks,

Mark

Connection Status Device connected
Current Configuration 1
Speed Full
Device Address 3
Number Of Open Pipes 4

Device Descriptor Swinxs Game Console
Offset Field Size Value Description
0 bLength 1 12h
1 bDescriptorType 1 01h Device
2 bcdUSB 2 0200h USB Spec 2.0
4 bDeviceClass 1 00h Class info in Ifc Descriptors
5 bDeviceSubClass 1 00h
6 bDeviceProtocol 1 00h
7 bMaxPacketSize0 1 40h 64 bytes
8 idVendor 2 C251h Keil Software, Inc.
10 idProduct 2 1708h
12 bcdDevice 2 0203h 2.03
14 iManufacturer 1 04h "Swinxs BV "
15 iProduct 1 20h "Swinxs Game Console"
16 iSerialNumber 1 48h "000050020801"
17 bNumConfigurations 1 01h

Configuration Descriptor 1 Bus Powered, 300 mA
Offset Field Size Value Description
0 bLength 1 09h
1 bDescriptorType 1 02h Configuration
2 wTotalLength 2 0040h
4 bNumInterfaces 1 02h
5 bConfigurationValue 1 01h
6 iConfiguration 1 00h
7 bmAttributes 1 80h Bus Powered
 4..0: Reserved  ...00000
 5: Remote Wakeup  ..0.....  No
 6: Self Powered  .0......  No, Bus Powered
 7: Reserved (set to one)
(bus-powered for 1.0)  1.......
8 bMaxPower 1 96h 300 mA

Interface Descriptor 0/0 HID, 2 Endpoints
Offset Field Size Value Description
0 bLength 1 09h
1 bDescriptorType 1 04h Interface
2 bInterfaceNumber 1 00h
3 bAlternateSetting 1 00h
4 bNumEndpoints 1 02h
5 bInterfaceClass 1 03h HID
6 bInterfaceSubClass 1 00h
7 bInterfaceProtocol 1 00h
8 iInterface 1 80h "Swinxs HID"

HID Descriptor
Offset Field Size Value Description
0 bLength 1 09h
1 bDescriptorType 1 21h HID
2 bcdHID 2 0110h 1.10
4 bCountryCode 1 00h
5 bNumDescriptors 1 01h
6 bDescriptorType 1 22h Report
7 wDescriptorLength 2 0045h 69 bytes

Endpoint Descriptor 81 1 In, Interrupt
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 0001h 1 byte
6 bInterval 1 00h

Endpoint Descriptor 01 1 Out, Interrupt
Offset Field Size Value Description
0 bLength 1 07h
1 bDescriptorType 1 05h Endpoint
2 bEndpointAddress 1 01h 1 Out
3 bmAttributes 1 03h Interrupt
 1..0: Transfer Type  ......11  Interrupt
 7..2: Reserved  000000..
4 wMaxPacketSize 2 0006h 6 bytes
6 bInterval 1 00h

Interface Descriptor 1/0 Mass Storage, 2 Endpoints
Offset Field Size Value Description
0 bLength 1 09h
1 bDescriptorType 1 04h Interface
2 bInterfaceNumber 1 01h
3 bAlternateSetting 1 00h
4 bNumEndpoints 1 02h
5 bInterfaceClass 1 08h Mass Storage
6 bInterfaceSubClass 1 06h SCSI Transparent Command Set
7 bInterfaceProtocol 1 50h Bulk-Only Transport
8 iInterface 1 62h "Swinxs Storage"

Endpoint Descriptor 82 2 In, Bulk, 64 bytes
Offset Field Size Value Description
0 bLength 1 07h
1 bDescriptorType 1 05h Endpoint
2 bEndpointAddress 1 82h 2 In
3 bmAttributes 1 02h Bulk
 1..0: Transfer Type  ......10  Bulk
 7..2: Reserved  000000..
4 wMaxPacketSize 2 0040h 64 bytes
6 bInterval 1 00h

Endpoint Descriptor 02 2 Out, Bulk, 64 bytes
Offset Field Size Value Description
0 bLength 1 07h
1 bDescriptorType 1 05h Endpoint
2 bEndpointAddress 1 02h 2 Out
3 bmAttributes 1 02h Bulk
 1..0: Transfer Type  ......10  Bulk
 7..2: Reserved  000000..
4 wMaxPacketSize 2 0040h 64 bytes
6 bInterval 1 00h

Interface 0 HID Report Descriptor
Item Tag (Value) Raw Data
Usage Page (Vendor-Defined 1) 06 00 FF
Usage (Undefined) 09 00
Collection (Application) A1 01
    Usage Page (Vendor-Defined 2) 06 01 FF
    Usage (Vendor-Defined 1) 09 01
    Logical Minimum (1) 15 01
    Logical Maximum (16777215) 27 FF FF FF 00
    Report Count (1) 95 01
    Report Size (24) 75 18
    Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit) 81 02
    Usage (Vendor-Defined 2) 09 02
    Report Count (1) 95 01
    Report Size (16) 75 10
    Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit) 81 02
    Usage Minimum (Vendor-Defined 1) 19 01
    Usage Maximum (Vendor-Defined 3) 29 03
    Logical Minimum (0) 15 00
    Logical Maximum (1) 25 01
    Report Count (3) 95 03
    Report Size (1) 75 01
    Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit) 81 02
    Report Count (1) 95 01
    Report Size (5) 75 05
    Input (Cnst,Ary,Abs) 81 01
    Usage Page (Vendor-Defined 3) 06 02 FF
    Usage (Vendor-Defined 16) 09 10
    Logical Minimum (0) 15 00
    Logical Maximum (100) 25 64
    Report Count (1) 95 01
    Report Size (8) 75 08
    Output (Data,Var,Abs,NWrp,Lin,Pref,NNul,NVol,Bit) 91 02
End Collection C0

Parents
  • You'll find __swi version of USB_WriteEP in Keil USBCDC example, as follows.

    C:\Keil\ARM\Boards\Keil\MCB2300\USBCDC
    
    usbhw.h
    
    extern DWORD __swi(8) USB_WriteEP (DWORD EPNum, BYTE *pData, DWORD cnt);
    
    usbhw.c
    
    /*
     *  Write USB Endpoint Data
     *    Parameters:      EPNum: Endpoint Number
     *                       EPNum.0..3: Address
     *                       EPNum.7:    Dir
     *                     pData: Pointer to Data Buffer
     *                     cnt:   Number of bytes to write
     *    Return Value:    Number of bytes written
     */
    
    DWORD __swi(8) USB_WriteEP (DWORD EPNum, BYTE *pData, DWORD cnt);
    DWORD __SWI_8              (DWORD EPNum, BYTE *pData, DWORD cnt) {
    //DWORD USB_WriteEP (DWORD EPNum, BYTE *pData, DWORD cnt) {
      DWORD n;
    
      USB_CTRL = ((EPNum & 0x0F) << 2) | CTRL_WR_EN;
    
      TX_PLENGTH = cnt;
    
      for (n = 0; n < (cnt + 3) / 4; n++) {
        TX_DATA = *((__packed DWORD *)pData);
        pData += 4;
      }
    
      USB_CTRL = 0;
    
      WrCmd(CMD_SEL_EP(EPAdr(EPNum)));
      WrCmd(CMD_VALID_BUF);
    
      return (cnt);
    }
    

    In the background, SWI.s is dragged in from RL_ARM,

    ;/*****************************************************************************/
    ;/* SWI.S: SWI Handler                                                        */
    ;/*****************************************************************************/
    ;/* This file is part of the uVision/ARM development tools.                   */
    ;/* Copyright (c) 2005-2006 Keil Software. All rights reserved.               */
    ;/* This software may only be used under the terms of a valid, current,       */
    ;/* end user licence from KEIL for a compatible version of KEIL software      */
    ;/* development tools. Nothing else gives you the right to use this software. */
    ;/*****************************************************************************/
    
    T_Bit           EQU     0x20
    
                    PRESERVE8                      ; 8-Byte aligned Stack
                    AREA    SWI_Area, CODE, READONLY
                    ARM
    
                    EXPORT  SWI_Handler
    SWI_Handler
    
                    STMFD   SP!, {R12, LR}         ; Store R12, LR
                    MRS     R12, SPSR              ; Get SPSR
                    STMFD   SP!, {R8, R12}         ; Store R8, SPSR
                    TST     R12, #T_Bit            ; Check Thumb Bit
                    LDRNEH  R12, [LR,#-2]          ; Thumb: Load Halfword
                    BICNE   R12, R12, #0xFF00      ;        Extract SWI Number
                    LDREQ   R12, [LR,#-4]          ; ARM:   Load Word
                    BICEQ   R12, R12, #0xFF000000  ;        Extract SWI Number
    
                    LDR     R8, SWI_Count
                    CMP     R12, R8
                    BHS     SWI_Dead               ; Overflow
                    ADR     R8, SWI_Table
                    LDR     R12, [R8,R12,LSL #2]   ; Load SWI Function Address
                    MOV     LR, PC                 ; Return Address
                    BX      R12                    ; Call SWI Function
    
                    LDMFD   SP!, {R8, R12}         ; Load R8, SPSR
                    MSR     SPSR_cxsf, R12         ; Set SPSR
                    LDMFD   SP!, {R12, PC}^        ; Restore R12 and Return
    
    SWI_Dead        B       SWI_Dead               ; None Existing SWI
    
    SWI_Cnt         EQU    (SWI_End-SWI_Table)/4
    SWI_Count       DCD     SWI_Cnt
    
                    IMPORT  __SWI_8
    
    SWI_Table
                    DCD     SWI_Dead               ; SWI 0 Function Entry used by RTX
                    DCD     SWI_Dead               ; SWI 1 Function Entry used by RTX
                    DCD     SWI_Dead               ; SWI 2 Function Entry used by RTX
                    DCD     SWI_Dead               ; SWI 3 Function Entry used by RTX
                    DCD     SWI_Dead               ; SWI 4 Function Entry used by RTX
                    DCD     SWI_Dead               ; SWI 5 Function Entry used by RTX
                    DCD     SWI_Dead               ; SWI 6 Function Entry used by RTX
                    DCD     SWI_Dead               ; SWI 7 Function Entry used by RTX
                    DCD     __SWI_8                ; SWI 8 Function Entry
    ;               ...
    SWI_End
    
                    END
    

    Also, LPC2300.s is modified a little to support SWI (SVC)

    LPC2300.s
    
    SVC_Stack_Size  EQU     0x00000100
    
    
    
    Vectors         LDR     PC, Reset_Addr
                    LDR     PC, Undef_Addr
    ...
    ...
    IRQ_Addr        DCD     IRQ_Handler
    FIQ_Addr        DCD     FIQ_Handler
    
                    IMPORT  SWI_Handler
    
    Undef_Handler   B       Undef_Handler
    ;SWI_Handler     B       SWI_Handler
    PAbt_Handler    B       PAbt_Handler
    DAbt_Handler    B       DAbt_Handler
    IRQ_Handler     B       IRQ_Handler
    FIQ_Handler     B       FIQ_Handler
    

    Tsuneo

Reply
  • You'll find __swi version of USB_WriteEP in Keil USBCDC example, as follows.

    C:\Keil\ARM\Boards\Keil\MCB2300\USBCDC
    
    usbhw.h
    
    extern DWORD __swi(8) USB_WriteEP (DWORD EPNum, BYTE *pData, DWORD cnt);
    
    usbhw.c
    
    /*
     *  Write USB Endpoint Data
     *    Parameters:      EPNum: Endpoint Number
     *                       EPNum.0..3: Address
     *                       EPNum.7:    Dir
     *                     pData: Pointer to Data Buffer
     *                     cnt:   Number of bytes to write
     *    Return Value:    Number of bytes written
     */
    
    DWORD __swi(8) USB_WriteEP (DWORD EPNum, BYTE *pData, DWORD cnt);
    DWORD __SWI_8              (DWORD EPNum, BYTE *pData, DWORD cnt) {
    //DWORD USB_WriteEP (DWORD EPNum, BYTE *pData, DWORD cnt) {
      DWORD n;
    
      USB_CTRL = ((EPNum & 0x0F) << 2) | CTRL_WR_EN;
    
      TX_PLENGTH = cnt;
    
      for (n = 0; n < (cnt + 3) / 4; n++) {
        TX_DATA = *((__packed DWORD *)pData);
        pData += 4;
      }
    
      USB_CTRL = 0;
    
      WrCmd(CMD_SEL_EP(EPAdr(EPNum)));
      WrCmd(CMD_VALID_BUF);
    
      return (cnt);
    }
    

    In the background, SWI.s is dragged in from RL_ARM,

    ;/*****************************************************************************/
    ;/* SWI.S: SWI Handler                                                        */
    ;/*****************************************************************************/
    ;/* This file is part of the uVision/ARM development tools.                   */
    ;/* Copyright (c) 2005-2006 Keil Software. All rights reserved.               */
    ;/* This software may only be used under the terms of a valid, current,       */
    ;/* end user licence from KEIL for a compatible version of KEIL software      */
    ;/* development tools. Nothing else gives you the right to use this software. */
    ;/*****************************************************************************/
    
    T_Bit           EQU     0x20
    
                    PRESERVE8                      ; 8-Byte aligned Stack
                    AREA    SWI_Area, CODE, READONLY
                    ARM
    
                    EXPORT  SWI_Handler
    SWI_Handler
    
                    STMFD   SP!, {R12, LR}         ; Store R12, LR
                    MRS     R12, SPSR              ; Get SPSR
                    STMFD   SP!, {R8, R12}         ; Store R8, SPSR
                    TST     R12, #T_Bit            ; Check Thumb Bit
                    LDRNEH  R12, [LR,#-2]          ; Thumb: Load Halfword
                    BICNE   R12, R12, #0xFF00      ;        Extract SWI Number
                    LDREQ   R12, [LR,#-4]          ; ARM:   Load Word
                    BICEQ   R12, R12, #0xFF000000  ;        Extract SWI Number
    
                    LDR     R8, SWI_Count
                    CMP     R12, R8
                    BHS     SWI_Dead               ; Overflow
                    ADR     R8, SWI_Table
                    LDR     R12, [R8,R12,LSL #2]   ; Load SWI Function Address
                    MOV     LR, PC                 ; Return Address
                    BX      R12                    ; Call SWI Function
    
                    LDMFD   SP!, {R8, R12}         ; Load R8, SPSR
                    MSR     SPSR_cxsf, R12         ; Set SPSR
                    LDMFD   SP!, {R12, PC}^        ; Restore R12 and Return
    
    SWI_Dead        B       SWI_Dead               ; None Existing SWI
    
    SWI_Cnt         EQU    (SWI_End-SWI_Table)/4
    SWI_Count       DCD     SWI_Cnt
    
                    IMPORT  __SWI_8
    
    SWI_Table
                    DCD     SWI_Dead               ; SWI 0 Function Entry used by RTX
                    DCD     SWI_Dead               ; SWI 1 Function Entry used by RTX
                    DCD     SWI_Dead               ; SWI 2 Function Entry used by RTX
                    DCD     SWI_Dead               ; SWI 3 Function Entry used by RTX
                    DCD     SWI_Dead               ; SWI 4 Function Entry used by RTX
                    DCD     SWI_Dead               ; SWI 5 Function Entry used by RTX
                    DCD     SWI_Dead               ; SWI 6 Function Entry used by RTX
                    DCD     SWI_Dead               ; SWI 7 Function Entry used by RTX
                    DCD     __SWI_8                ; SWI 8 Function Entry
    ;               ...
    SWI_End
    
                    END
    

    Also, LPC2300.s is modified a little to support SWI (SVC)

    LPC2300.s
    
    SVC_Stack_Size  EQU     0x00000100
    
    
    
    Vectors         LDR     PC, Reset_Addr
                    LDR     PC, Undef_Addr
    ...
    ...
    IRQ_Addr        DCD     IRQ_Handler
    FIQ_Addr        DCD     FIQ_Handler
    
                    IMPORT  SWI_Handler
    
    Undef_Handler   B       Undef_Handler
    ;SWI_Handler     B       SWI_Handler
    PAbt_Handler    B       PAbt_Handler
    DAbt_Handler    B       DAbt_Handler
    IRQ_Handler     B       IRQ_Handler
    FIQ_Handler     B       FIQ_Handler
    

    Tsuneo

Children
No data