cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F429 USB CDC Bulk data receive problem

urbanekmirek
Associate
Posted on February 12, 2016 at 23:44

Hi all,

I am trying to develop my own DisplayLink device with STM32F429 Discovery board. I use CDC as a template of it. Whole edited enumeration pass OK. But when I need to receive data from EP 1 (OUT Bulk) than occurs a problem.

I have whole project generated from Cube MX. This way I am trying to read data

uint8_t ht[4620];
uint8_t result = USBD_OK;
do
{
result = USBD_CDC_SetRxBuffer(pdev, ht);
}
while(result != USBD_OK);
do
{
result = USBD_CDC_ReceivePacket(pdev);
}
while(result != USBD_OK);
HuffmanTable = ht;

But it doesn´t send success response to USB host. Thanks for any help. #stm32f4-usb-cdc-device #discovery #stm32f4
2 REPLIES 2
gbm
Lead III
Posted on February 15, 2016 at 10:06

1. Change the following define:

#define APP_RX_DATA_SIZE 64

2.

USBD_CDC_ReceivePacket

() does not receive anything, it only arms the interface for data reception. The function should be called from CDC_Init_FS(), but it isn't. Add the call before return from

CDC_Init_FS().

3. When the data is received, CDC_Receive_FS() is called by USB framework. You should process the incoming data in this function. After processing, call

USBD_CDC_ReceivePacket

() to re-arm for reception.

There are some more quirks and problems in the CubeMX USB CDC stuff.

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice
urbanekmirek
Associate
Posted on February 18, 2016 at 13:48

Thanks a lot!!!

This exactly solved my problem!  

As you said, I found a lot of irregularities in that generated code. For example comments above methods sometimes doesn't match the methods. Also a naming of methods are sometimes crazy. I have generated code for my discovery board which works in FS but all methods has HS instad of FS in their names. But works as FS... 

Thank you! You saved me a lot of time and worry.