AnsweredAssumed Answered

USB composite device first packet always empty

Question asked by Nix Wayne on Nov 13, 2017
Latest reply on Nov 14, 2017 by Nix Wayne



I am working with STM32F072RB and I am developing composite device. The device consists of 3 different interfaces but only one has in and out endpoints. It's custom HID with input and output report of 64 bytes. Really nothing special. My code includes many define switched so I can easily switch from composite device with 3 interfaces to simple Custom HID device. 


So to my question...


I am sending data from PC to device. If I am using device as a custom hid device I can receive data and DataOut function gets always called. 


static uint8_t USBD_HID_DataOut (USBD_HandleTypeDef *pdev, uint8_t epnum)



Received data is valid.


Then I switch to composite device configuration and that same Custom HID is just one those 3 interfaces in that composite device. In that case I experience strange behaviour...


The first packet I send from PC to device has all zeros inside... so no data is present. If I retry to send same data again I get valid data. So the first packet is always filled with zeros.  



 USBD_HID_HandleTypeDef     *hhid = (USBD_HID_HandleTypeDef*)pdev->pClassData;  


hhid->IsReportAvailable is set to zero first time and next time to a some non-zero value (0xD0).


Any idea what I should look at?


Thank you in advance.