2014-04-06 01:09 AM
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 #usb2014-04-06 06:38 AM
The use of receiveBufferPtr would seem to lend itself to failure on repeated calls to the function.
2014-04-06 08:27 AM
Call USBD_CDC_ReceivePacket() for the next packet, at the end of your CDC_Receive()
USBD_CDC_ReceivePacket(&hUsbDeviceFS); Tsuneo