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

MCSTR9 USB can't change the InputReport >64 Bytes

I'm trying to change the input report to 100 but it doen't work. I read almost all the threads of Tsuneo, but i can not get it to work. When I use the "SimpleHIDwrite" and try to get the reports i get "Get Report Error: Data Error (Cyclic redundancy check) (17)".

This only happens when i tried to make the input_report > 64 Bytes, otherwise works perfect
other thing is that i read that if the packet that you send is smaller is automatically reduced, but not to me :(.
From USBcfg.h i have the nexts defines

#define USB_MAX_PACKET0     64
#define InReport_length         100

Here i will put my report descriptor:

const BYTE HID_ReportDescriptor[] = {
  HID_UsagePageVendor( 0x00                                   ),
  HID_Usage(           0x01                                   ),
  HID_Collection(      HID_Application                        ),
    HID_LogicalMin(    0                                      ),
    HID_LogicalMaxS(   0xFF                                   ),
    HID_ReportSize(    8                                      ),  // bits
    HID_ReportCount(   InReport_length                        ),  // bytes
    HID_Usage(         0x01                                   ),
    HID_Input(         HID_Data | HID_Variable | HID_Absolute ),
    HID_ReportCount(   4                                      ),  // bytes
    HID_Usage(         0x01                                   ),
    HID_Output(        HID_Data | HID_Variable | HID_Absolute ),
  HID_EndCollection,
};
const WORD HID_ReportDescSize = sizeof(HID_ReportDescriptor);

This part is in USBconfigdescriptor[]

const BYTE USB_ConfigDescriptor[] = {
.....
.....
 USB_ENDPOINT_DESC_SIZE,            /* bLength */
  USB_ENDPOINT_DESCRIPTOR_TYPE,      /* bDescriptorType */
  USB_ENDPOINT_IN(1),                /* bEndpointAddress */
  USB_ENDPOINT_TYPE_INTERRUPT,       /* bmAttributes */
  WBVAL(0x0040),                     /* wMaxPacketSize */
  0x02,           /* 2ms */          /* bInterval */
/* Terminator */
  0                                  /* bLength */
};

I think that the problem may be is in hiduser.c but i could't check it because i didn't find code for this

BOOL HID_GetReport (void) {
  int i;
  /* ReportID = SetupPacket.wValue.WB.L; */

  switch (SetupPacket.wValue.WB.H) {
    case HID_REPORT_INPUT:
      GetInReport();
      for(i=0;i< InReport_length ;i++)
                EP0Buf[i] = InReport[i];                /*Copy all the report to send*/
          break;
    case HID_REPORT_OUTPUT:
      return (FALSE);          /* Not Supported */
    case HID_REPORT_FEATURE:
      /* EP0Buf[] = ...; */
      /* break; */
      return (FALSE);          /* Not Supported */
  }
  return (TRUE);
}


where EP0Buf[] is define in USBcore.h

extern BYTE  EP0Buf[USB_MAX_PACKET0];


Of course i realized that EP0Buf was smaller so i tried doing

extern BYTE  EP0Buf[InReport_length];

but was the same
Endpoint 1 is

void USB_EndPoint1 (DWORD event) {
  InEP_empty = TRUE;
}

If you need more info to deduce my problem just tell me..
Thanks

Parents
  • The SetReport (output ) is this.

    BOOL HID_SetReport (void) {
     int i;
    
      /* ReportID = SetupPacket.wValue.WB.L; */
      switch (SetupPacket.wValue.WB.H) {
        case HID_REPORT_INPUT:
          return (FALSE);          /* Not Supported */
        case HID_REPORT_OUTPUT:
          for (i = 0; i < USB_MAX_PACKET0; i++) { /* whole packet is copied */
            OutReport[i] = EP0Buf[i];
          }
              SetOutReport();
          break;
        case HID_REPORT_FEATURE:
          return (FALSE);          /* Not Supported */
      }
      return (TRUE);
    }
    

    The problem is in the Input report, you can noticed that i'm only replying when i have data to do it.
    I solve my problem in a rustic way, i split my self the packet, but i would like to know what is the problem here.

    Tsuneo, you don't have to apologize because of the time it takes you to reply, you always reply and that is the most important. Thank you for your time and dedication :D

Reply
  • The SetReport (output ) is this.

    BOOL HID_SetReport (void) {
     int i;
    
      /* ReportID = SetupPacket.wValue.WB.L; */
      switch (SetupPacket.wValue.WB.H) {
        case HID_REPORT_INPUT:
          return (FALSE);          /* Not Supported */
        case HID_REPORT_OUTPUT:
          for (i = 0; i < USB_MAX_PACKET0; i++) { /* whole packet is copied */
            OutReport[i] = EP0Buf[i];
          }
              SetOutReport();
          break;
        case HID_REPORT_FEATURE:
          return (FALSE);          /* Not Supported */
      }
      return (TRUE);
    }
    

    The problem is in the Input report, you can noticed that i'm only replying when i have data to do it.
    I solve my problem in a rustic way, i split my self the packet, but i would like to know what is the problem here.

    Tsuneo, you don't have to apologize because of the time it takes you to reply, you always reply and that is the most important. Thank you for your time and dedication :D

Children