cancel
Showing results for 
Search instead for 
Did you mean: 

USB Host CDC Receives Data as 64-bytes, How to get complete (received) data in a buffer

Faiz Ahmed
Associate II
Posted on November 08, 2017 at 10:32

Hi,

i m using STM32f746G-DISC board for USB HOST in CDC mode, i m trying to receive data of 256-bytes (which is transmitted from another board) but i am able to receive only 64-bytes (stored in CDC_RX_Buffer[ ])...

 How to get Total data (of 256 bytes).

#stm32f7-usb-receive #stm #stm32f7-discovery #stm32f7-receive-interrupt #stm32f7-usb-host-cdc
1 REPLY 1
Ant M
Associate II
Posted on November 08, 2017 at 12:03

Hi,

You will need to store 64 bytes away each time before leaving the receive function CDC_Receive_FS, as that is the most that will arrive in one interrupt if you are using a 64 byte endpoint.

Each time in the receive function, copy your data to a buffer and increment the buffer pointer by the amount received ready for next time. As you say, there is a user buffer already provided (alter APP_RX_DATA_SIZE to 256 and have a moving pointer), or you could just have your own.

Maybe have a structure, which has your 256 byte buffer, a pointer which you will alter, and a flag to say that a full data packet has been received... but it depends on your application.

Ant