cancel
Showing results for 
Search instead for 
Did you mean: 

Get lenght of all data transferred in CDC

urbanekmirek
Associate
Posted on March 31, 2016 at 14:21

Hi all,

I have a problem with CDC class. I have 26464 bytes on USB Host to transfer to my SM32F429 Discovery device.

I need to receive all these data and after that do some parsing.

How to do this trick in this function? :

static int8_t CDC_Receive_HS (uint8_t* Buf, uint32_t *Len)

{

/* USER CODE BEGIN 11 */

USBD_CDC_ReceivePacket(hUsbDevice_1);

return (USBD_OK);

/* USER CODE END 11 */

}

I cant get the total lenght of data. USBD_CDC_ReceivePacket only receives another 64/512 bytes from hosts buffer. Am i right? How can i detect end of recieving?

Thanks a lot.
1 REPLY 1
Walid FTITI_O
Senior II
Posted on March 31, 2016 at 16:02

Hi urbanek.mirek,

usbd_cdc_if.c is a driver for user application, and the code implemented now is just for help so you can modify it or add your own code [in user code section].

I recommend that you refer to the user code proposed in this [DEAD LINK /public/STe2ecommunities/mcu/Lists/STM32Java/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/STM32Java/STM32%20Virtual%20Com%20Port%20problem&FolderCTID=0x01200200770978C69A1141439FE559EB459D758000F9A0E3A95BA69146A17C2E80209ADC21&TopicsView=https%3a//my.st.com/public/STe2ecommunities/mcu/Lists/STM32Java/AllItems.aspx?View%3D%257bA4EEE515%252d04F0%252d42D9%252dAC32%252dA6D8340F101B%257d%26FolderCTID%3D0x012001&currentviews=161]discussion.

For more details, on how you use the STM32Cube USB device library, please refer to

http://www.st.com/st-web-ui/static/active/en/resource/technical/document/user_manual/DM00108129.pdf?s_searchtype=keyword

user manual.

-Hannibal-