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 HID multiple packet problem

Trying to send an InReport > 64 bytes. Read all threads(thanks Tsuneo) but still not working. That is too say, I'm using SimpleHIDWrite as my tester, 64-byte packets work fine. If I run this code, sending a 65-byte In Report using 2-packets, I get from SimplHIDWrite "Get Report Error: CRC mismatch (17)". Any help much appreciated!

BOOL HID_GetReport (void)
{

// ReportID = SetupPacket.wValue.WB.L;
switch (SetupPacket.wValue.WB.H)
{
    case HID_REPORT_INPUT:
        //We've been asked to report, go get report and send 1st packet
        GetInReport();
        //memcpy(&EP0Buf[0],(u8*)&MyInReport[0],sizeof(MyInReport));
        //memcpy(&EP0Buf[0],(u8*)&MyInReport[0],64);
        break;
    case HID_REPORT_OUTPUT:
        return (FALSE);          // Not Supported
    case HID_REPORT_FEATURE:
        /* EP0Buf[] = ...; */
        /* break; */
        return (FALSE);          // Not Supported
 }
        return (TRUE);
}


*******************************************************************

void GetInReport (void)
{

        // Check if PBINT is pressed
        if((IOPIN0 & PBINT) == 0)
        {       //just add some data for now
                MyInReport[0] = 0xC1;
                MyInReport[1] = 0xD1;
                MyInReport[63] = 0x63;
        }
        else
        {       //just add some data for now
                MyInReport[0] = 0xC0;
                MyInReport[1] = 0xD0;
                MyInReport[63] = 0x63;
        }
        VICIntEnClr  |= 0x00400000;            // Disable USB Interrupt
        USB_WriteEP(0x81, &MyInReport[0], 64); //Send 1st packet, 64 bytes
        iNextInPacket = 1;                     //Set flag for EP1 ISR
        VICIntEnable |= 0x00400000;            // Enable USB Interrupt

}

***********************************************************************

void USB_EndPoint1 (DWORD event)
{

        switch (event)
        {
                case USB_EVT_IN:
                    if(iNextInPacket)
                    {  //OK, more data, send second packet (1-byte, total of 65-byte report)
                          iNextInPacket = 0;
                          USB_WriteEP(0x81, &MyInReport[64], 1);
                    }
                    break;
        }
}

Parents
  • Thanks, controller is LPC2148. I understand your fix and attempted, still get error from SimpleHIDWrite of "GET REPORT ERROR: Data error (cyclic redundancy error) (17)". We never even get to the HID_GetReport() code. Must be that it errors when attempting to do a GetReport call of > 64 bytes?
    Anyway, couldn't your fix just be to increase the size of EP0Buf?

Reply
  • Thanks, controller is LPC2148. I understand your fix and attempted, still get error from SimpleHIDWrite of "GET REPORT ERROR: Data error (cyclic redundancy error) (17)". We never even get to the HID_GetReport() code. Must be that it errors when attempting to do a GetReport call of > 64 bytes?
    Anyway, couldn't your fix just be to increase the size of EP0Buf?

Children
No data