Hi, i want to transfer to/from 64 bytes from kit to pc and viceversa.so i made the following changes in the code. in HID_Client VC++ program in HIDClientDlg.cpp the if conidtion on !HID_WRITE(); is becomes false and executing OnError(); so herewith i'd attached the program modification. Please can anyone tell me what mistake i made or what correction/modification i need to carry.
in the USBTrace the buffer shows the value sent from kit to PC. So i think the transfer from kit to pc is ok. it is problem with receiving from pc. or problem with Device descriptor.
with regards
S.Venugopal
void CHIDClientDlg::OnSelchangeDevice() { DWORD cnt; int n; /*-------- if (!HID_Write(OutReport, sizeof(OutReport), &cnt)) { OnError(); return; } -------------*/ } // in usbdesc.c /* HID Report Descriptor */ const BYTE HID_ReportDescriptor[] = { HID_UsagePageVendor(0x00), HID_Usage(0x01), HID_Collection(HID_Application), HID_UsagePage(HID_USAGE_PAGE_GENERIC), HID_UsageMin(0), HID_UsageMax(255), HID_LogicalMin(0), HID_LogicalMaxS(255), HID_ReportCount(64), HID_ReportSize(8), HID_Input(HID_Data | HID_Variable | HID_Absolute), HID_Usage(HID_USAGE_GENERIC_UNDEFINED), HID_LogicalMin(0), HID_LogicalMaxS(255), HID_ReportCount(64), HID_ReportSize(8), HID_Output(HID_Data | HID_Variable | HID_Absolute), HID_EndCollection, }; const WORD HID_ReportDescSize = sizeof(HID_ReportDescriptor); // const BYTE USB_ConfigDescriptor[] = { //WBVAL(0x0004), /* wMaxPacketSize -- 4*/ WBVAL(0x0040), /* wMaxPacketSize -- 64*/ // 0x20, /* 32ms */ /* bInterval */ 0xFA, /* 250ms */ /* bInterval */ /* Terminator */ 0 /* bLength */ }; /*************************************************/ // in demo.c BYTE InReport[USB_MAX_PACKET0]; BYTE OutReport[USB_MAX_PACKET0]; void GetInReport (void) { unsigned char i; for (i=0; i<=64; i++) { InReport[i] = i; } } void SetOutReport (void) { GPIOB->ODR = (OutReport[0] << 8); // All LED Bits are set } /*************************************************/ // in demo.h extern BYTE InReport[USB_MAX_PACKET0]; extern BYTE OutReport[USB_MAX_PACKET0]; /*************************************************/ //inc usbcfg.h //#define USB_MAX_PACKET0 8 #define USB_MAX_PACKET0 64 /*************************************************/ // in usbuser.c #if USB_CONFIGURE_EVENT void USB_Configure_Event (void) { if (USB_Configuration) { /* Check if USB is configured */ GetInReport(); USB_WriteEP(0x81, &InReport[0], sizeof(InReport)); } } #endif //----------------------------------------------------- void USB_EndPoint1 (DWORD event) { GetInReport(); USB_WriteEP(0x81, &InReport[0], sizeof(InReport)); } //------------------------------------------------------ BOOL HID_GetReport (void) { unsigned char i; /* ReportID = SetupPacket.wValue.WB.L; */ switch (SetupPacket.wValue.WB.H) { case HID_REPORT_INPUT: GetInReport(); for(i=0; i<=64; i++) { EP0Buf[i] = InReport[i]; } break; case HID_REPORT_OUTPUT: return (FALSE); /* Not Supported */ case HID_REPORT_FEATURE: /* EP0Buf[] = ...; */ /* break; */ return (FALSE); /* Not Supported */ } return (TRUE); } //------------------------------------------------------ BOOL HID_SetReport (void) { /* ReportID = SetupPacket.wValue.WB.L; */ switch (SetupPacket.wValue.WB.H) { case HID_REPORT_INPUT: return (FALSE); /* Not Supported */ case HID_REPORT_OUTPUT: OutReport[0] = EP0Buf[0]; SetOutReport(); break; case HID_REPORT_FEATURE: return (FALSE); /* Not Supported */ } return (TRUE); } //---------------------------------------------------