cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4 Discovery OTG FS Device Issue

emeydanli
Associate II
Posted on April 06, 2014 at 10:09

Hello Everyone,

I am trying to send and receive data on STM32F4 Discovery over USB. USB is configured as Virtual Com Port (CDC) and running at full speed. STM32CubeMX is set up on my machine and the project that I have been using was generated by this software. I only added a few lines of code inside CDC_Receive function that is seen below:

uint8_t receiveBuffer[512];

uint8_t *receiveBufferPtr = &receiveBuffer[0];

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

{

   int i;

   for (i = 0; i < *Len; ++i)

       *receiveBufferPtr++ = Buf[i];

  

  return USBD_OK;

}

With the help of a terminal software I am sending characters to the device. In the first keyboard hit, CDC_Receive is being called. However, after receiving the first character, somehow the device stops getting data. No interrupt is coming for EP1 anymore. 

My test machine is Win7 x64 and STMicroelectronics Com Port driver is installed.

What might be the issue?

Any help is appreciated. Thanks in advance.

#discovery #stm32f4 #usb
2 REPLIES 2
Posted on April 06, 2014 at 15:38

The use of receiveBufferPtr would seem to lend itself to failure on repeated calls to the function.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
tsuneo
Senior
Posted on April 06, 2014 at 17:27

Call USBD_CDC_ReceivePacket() for the next packet, at the end of your CDC_Receive()

USBD_CDC_ReceivePacket(&hUsbDeviceFS);

Tsuneo