2011-07-15 06:31 AM
Hello,
I'm stucked at programming a USB. Based on ST USB Library and sample project (Custom HID) i've created an program that send to PC data in report of size 10 bytes. So i changed an description of usb (in usb_desc.c) lines (101, 112 and 226 line) commented as: /* REPORT_SIZE */ and /* wMaxPacketSize*/ On STM Eval B it's works fine. I have bigger packet size, but when i recompile code and run it on STM Eval C with STM32F107 my packet are still 2 bytes length as in example. Could anyone can help me? Maybe provide USB HID code for a CL processors? best regards Micha? #usb-stm32cl-hid2011-07-18 02:36 AM
Take care of many conditional defines regarding CL line in the application part of the USB library. I suppose, you have changed the defines that are in effect for MD line only. My suggestion is, place #warning ''your text'' in the #ifdef...#else..#endif sections to monitor, what section is being compiled.
2011-07-18 12:56 PM
> with STM32F107 my packet are still 2 bytes length as in example.
Did you replace these ''2''s into 10 (or 11, including report ID) at the last argument of OTG_DEV_EP_Init()? The last argument tells wMaxPacketSize of the EP to the USB engine. usb_prop.c void CustomHID_Reset(void) { /* Set Joystick_DEVICE as not configured */ pInformation->Current_Configuration = 0; pInformation->Current_Interface = 0;/*the default Interface*/ /* Current Feature initialization */ pInformation->Current_Feature = CustomHID_ConfigDescriptor[7]; #ifdef STM32F10X_CL /* EP0 is already configured in DFU_Init() by USB_SIL_Init() function */ /* Init EP1 IN as Interrupt endpoint */ OTG_DEV_EP_Init(EP1_IN, OTG_DEV_EP_TYPE_INT, 2); //<------ /* Init EP1 OUT as Interrupt endpoint */ OTG_DEV_EP_Init(EP1_OUT, OTG_DEV_EP_TYPE_INT, 2); //<------ #else ... Tsuneo2011-07-19 08:53 AM
Yes, that works. Thanks.