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

Usb failed packets

Hello,

What could be causing failed packets


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

Device Descriptor NXP LPC17xx Speaker
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 1FC7h
10 idProduct 2 4005h
12 bcdDevice 2 0100h 1.00
14 iManufacturer 1 01h "NXP Semicond "
15 iProduct 1 02h "NXP LPC17xx Speaker "
16 iSerialNumber 1 03h "DEMO00000000"
17 bNumConfigurations 1 01h

Configuration Descriptor 1 Bus Powered, 100 mA
Offset Field Size Value Description
0 bLength 1 09h
1 bDescriptorType 1 02h Configuration
2 wTotalLength 2 0076h
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 32h 100 mA

Interface Descriptor 0/0 Audio, 0 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 00h
5 bInterfaceClass 1 01h Audio
6 bInterfaceSubClass 1 01h Audio Control
7 bInterfaceProtocol 1 00h
8 iInterface 1 00h

Audio Control Interface Header Descriptor
Offset Field Size Value Description
0 bLength 1 09h
1 bDescriptorType 1 24h Audio Control Interface Header
2  7 01 00 01 27 00 01 01

Audio Control Input Terminal Descriptor
Offset Field Size Value Description
0 bLength 1 0Ch
1 bDescriptorType 1 24h Audio Control Input Terminal
2  10 02 01 01 01 00 01 00 00
00 00

Audio Control Feature Unit Descriptor
Offset Field Size Value Description
0 bLength 1 09h
1 bDescriptorType 1 24h Audio Control Feature Unit
2  7 06 02 01 01 03 00 00

Audio Control Output Terminal Descriptor
Offset Field Size Value Description
0 bLength 1 09h
1 bDescriptorType 1 24h Audio Control Output Terminal
2  7 03 03 01 03 00 02 00

Interface Descriptor 1/0 Audio, 0 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 00h
5 bInterfaceClass 1 01h Audio
6 bInterfaceSubClass 1 02h Audio Streaming
7 bInterfaceProtocol 1 00h
8 iInterface 1 00h

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

Audio Streaming Interface Descriptor
Offset Field Size Value Description
0 bLength 1 07h
1 bDescriptorType 1 24h Audio Streaming Interface
2  5 01 01 01 01 00

Audio Streaming Format Type Descriptor
Offset Field Size Value Description
0 bLength 1 0Bh
1 bDescriptorType 1 24h Audio Streaming Format Type
2  9 02 01 01 02 10 01 40 1F
00

Endpoint Descriptor 03 3 Out, Isochronous, 1 ms
Offset Field Size Value Description
0 bLength 1 09h
1 bDescriptorType 1 05h Endpoint
2 bEndpointAddress 1 03h 3 Out
3 bmAttributes 1 05h Isochronous, Asynchronous, Data
 1..0: Transfer Type  ......01  Isochronous
 3..2: Sync Type  ....01..  Asynchronous
 5..4: Usage Type  ..00....  Data
 7..6: Reserved  00......
4 wMaxPacketSize 2 0012h 18 bytes
6 bInterval 1 01h 1 ms
7 bRefresh 1 00h
8 bSynchAddress 1 83h

Audio Streaming Isochronous Audio Data Endpoint Descriptor
Offset Field Size Value Description
0 bLength 1 07h
1 bDescriptorType 1 25h Audio Streaming Isochronous Audio Data Endpoint
2  5 01 00 02 00 00

Endpoint Descriptor 83 3 In, Isochronous, 1 ms
Offset Field Size Value Description
0 bLength 1 09h
1 bDescriptorType 1 05h Endpoint
2 bEndpointAddress 1 83h 3 In
3 bmAttributes 1 01h Isochronous, No Sync, Data
 1..0: Transfer Type  ......01  Isochronous
 3..2: Sync Type  ....00..  No Sync
 5..4: Usage Type  ..00....  Data
 7..6: Reserved  00......
4 wMaxPacketSize 2 0003h 3 bytes
6 bInterval 1 01h 1 ms
7 bRefresh 1 01h
8 bSynchAddress 1 00h

http://pastebin.com/gbdKGnwQ


URB     0006-0003       4:11:41.526     6.746 ms        71 us   Sync Reset Pipe and Clear Stall                         01:01:83        83DEC6F0h       USBPDO-5        usbhub  84E65E00h       Success (Success)
URB     0007-0002       4:11:41.526     6.749 ms        88 us   Sync Reset Pipe and Clear Stall                         01:01:83        83DC8C80h       0000007a        usbccgp 84E65E00h       Success (Success)
URB     0008    4:11:41.526     6.758 ms                Isoch Transfer  3 bytes buffer          in      01:01:83        83DC8C80h       0000007a        usbccgp 84FD5790h
URB     0009    4:11:41.526     6.763 ms                Isoch Transfer  3 bytes buffer          in      01:01:83        83DEC6F0h       USBPDO-5        usbhub  84FD5790h
URB     0010-0009       4:11:41.526     6.831 ms        69 us   Isoch Transfer                  in      01:01:83        83DEC6F0h       USBPDO-5        usbhub  84FD5790h       Unsuccessful (Internal HC Error)
URB     0011-0008       4:11:41.526     6.834 ms        77 us   Isoch Transfer                  in      01:01:83        83DC8C80h       0000007a        usbccgp 84FD5790h       Unsuccessful (Internal HC Error)
URB     0012    4:11:41.526     6.847 ms                Sync Reset Pipe and Clear Stall                         01:01:83        83DC8C80h       0000007a        usbccgp 83DD4008h
URB     0013    4:11:41.526     6.853 ms                Sync Reset Pipe and Clear Stall                         01:01:83        83DEC6F0h       USBPDO-5        usbhub  83DD4008h
URB     0014-0013       4:11:41.526     6.889 ms        36 us   Sync Reset Pipe and Clear Stall                         01:01:83        83DEC6F0h       USBPDO-5        usbhub  83DD4008h       Success (Success)
URB     0015-0012       4:11:41.526     6.892 ms        45 us   Sync Reset Pipe and Clear Stall                         01:01:83        83DC8C80h       0000007a        usbccgp 83DD4008h       Success (Success)



Parents
No data
Reply
  • /*----------------------------------------------------------------------------
     *      U S B  -  K e r n e l
     *----------------------------------------------------------------------------
     *      Name:    ADCUSER.C
     *      Purpose: Audio Device Class Custom User Module
     *      Version: V1.10
     *----------------------------------------------------------------------------
     *      This software is supplied "AS IS" without any warranties, express,
     *      implied or statutory, including but not limited to the implied
     *      warranties of fitness for purpose, satisfactory quality and
     *      noninfringement. Keil extends you a royalty-free right to reproduce
     *      and distribute executable files created using this software for use
     *      on NXP Semiconductors LPC family microcontroller devices only. Nothing
     *      else gives you the right to use this software.
     *
     * Copyright (c) 2009 Keil - An ARM Company. All rights reserved.
     *---------------------------------------------------------------------------*/
    
    #include "type.h"
    
    #include "usb.h"
    #include "audio.h"
    #include "usbcfg.h"
    #include "usbcore.h"
    #include "adcuser.h"
    
    #include "usbaudio.h"
    
          uint16_t VolCur = 0x0100;     /* Volume Current Value */
    const uint16_t VolMin = 0x0000;     /* Volume Minimum Value */
    const uint16_t VolMax = 0x0100;     /* Volume Maximum Value */
    const uint16_t VolRes = 0x0004;     /* Volume Resolution */
    
    /*
     *  Audio Device Class Interface Get Request Callback
     *   Called automatically on ADC Interface Get Request
     *    Parameters:      None (global SetupPacket and EP0Buf)
     *    Return Value:    TRUE - Success, FALSE - Error
     */
    
    uint32_t ADC_IF_GetRequest (void) {
    
    /*
      Interface = SetupPacket.wIndex.WB.L;
      EntityID  = SetupPacket.wIndex.WB.H;
      Request   = SetupPacket.bRequest;
      Value     = SetupPacket.wValue.W;
      ...
    */
    
      if (SetupPacket.wIndex.W == 0x0200) {
        /* Feature Unit: Interface = 0, ID = 2 */
        if (SetupPacket.wValue.WB.L == 0) {
          /* Master Channel */
          switch (SetupPacket.wValue.WB.H) {
            case AUDIO_MUTE_CONTROL:
              switch (SetupPacket.bRequest) {
                case AUDIO_REQUEST_GET_CUR:
                  EP0Buf[0] = Mute;
                  return (TRUE);
              }
              break;
            case AUDIO_VOLUME_CONTROL:
              switch (SetupPacket.bRequest) {
                case AUDIO_REQUEST_GET_CUR:
                  *((__packed uint16_t *)EP0Buf) = VolCur;
                  return (TRUE);
                case AUDIO_REQUEST_GET_MIN:
                  *((__packed uint16_t *)EP0Buf) = VolMin;
                  return (TRUE);
                case AUDIO_REQUEST_GET_MAX:
                  *((__packed uint16_t *)EP0Buf) = VolMax;
                  return (TRUE);
                case AUDIO_REQUEST_GET_RES:
                  *((__packed uint16_t *)EP0Buf) = VolRes;
                  return (TRUE);
              }
              break;
          }
        }
      }
      return (FALSE);  /* Not Supported */
    }
    
    
    /*
     *  Audio Device Class Interface Set Request Callback
     *   Called automatically on ADC Interface Set Request
     *    Parameters:      None (global SetupPacket and EP0Buf)
     *    Return Value:    TRUE - Success, FALSE - Error
     */
    
    uint32_t ADC_IF_SetRequest (void) {
    
    /*
      Interface = SetupPacket.wIndex.WB.L;
      EntityID  = SetupPacket.wIndex.WB.H;
      Request   = SetupPacket.bRequest;
      Value     = SetupPacket.wValue.W;
      ...
    */
    
      if (SetupPacket.wIndex.W == 0x0200) {
        /* Feature Unit: Interface = 0, ID = 2 */
        if (SetupPacket.wValue.WB.L == 0) {
          /* Master Channel */
          switch (SetupPacket.wValue.WB.H) {
            case AUDIO_MUTE_CONTROL:
              switch (SetupPacket.bRequest) {
                case AUDIO_REQUEST_SET_CUR:
                  Mute = EP0Buf[0];
                  return (TRUE);
              }
              break;
            case AUDIO_VOLUME_CONTROL:
              switch (SetupPacket.bRequest) {
                case AUDIO_REQUEST_SET_CUR:
                  VolCur = *((__packed uint16_t *)EP0Buf);
                  return (TRUE);
              }
              break;
          }
        }
      }
      return (FALSE);  /* Not Supported */
    }
    
    
    /*
     *  Audio Device Class EndPoint Get Request Callback
     *   Called automatically on ADC EndPoint Get Request
     *    Parameters:      None (global SetupPacket and EP0Buf)
     *    Return Value:    TRUE - Success, FALSE - Error
     */
    
    uint32_t ADC_EP_GetRequest (void) {
    
    /*
      EndPoint = SetupPacket.wIndex.WB.L;
      Request  = SetupPacket.bRequest;
      Value    = SetupPacket.wValue.W;
      ...
    */
      return (FALSE);  /* Not Supported */
    }
    
    
    /*
     *  Audio Device Class EndPoint Set Request Callback
     *   Called automatically on ADC EndPoint Set Request
     *    Parameters:      None (global SetupPacket and EP0Buf)
     *    Return Value:    TRUE - Success, FALSE - Error
     */
    
    uint32_t ADC_EP_SetRequest (void) {
    
    /*
      EndPoint = SetupPacket.wIndex.WB.L;
      Request  = SetupPacket.bRequest;
      Value    = SetupPacket.wValue.W;
      ...
    */
      return (FALSE);  /* Not Supported */
    }
    

    After searching the internet, the best I have come with is that, it could have something to do
    with usb.h and adcuser.c

    in windows 7 every 50 to 80 us SYNC_RESET_PIPE_AND_CLEAR_STALL is being issued and failing causing lost packets and out of sequence audio packets

    case URB_FUNCTION_SYNC_CLEAR_STALL and case case URB_FUNCTION_SYNC_RESET_PIPE. These allow client drivers to clear the ENDPOINT_HALT feature on the device, or reset the pipe on the host side, respectively, without affecting the data toggle on the host side. If the device does not reset the data toggle when it should, then the client driver can compensate for this defect by not resetting the host-side data toggle.

    If the data toggle is reset on the host side but not on the device side, packets will get out of sequence, and the device might drop packets
    

Children