virtual com problems with STM32L4P5VGT6
Hi,
I prototype the use the USB virtual com port on a STM32F407 Discovery board and
it worked without any problem. I then repeated the exercise on our custom board
(STM32L4P5VGT6), the first stage was just transmitting it worked without a
problem. Now adding the exactly the same code for receiving I used on the
STM32F407 board, when the USB cable is plugged in the USB is enumerated
correctly under Windows 10, but I cannot connect to it with my terminal program.
It behaves same with different terminal programs and on different computers.
After a couple minutes Windows 10 reports a problem with the USB device just
plugged in.
The receiver I added is:
static int8_t CDC_Receive_FS(uint8_t* Buf, uint32_t *Len)
{
/* USER CODE BEGIN 6 */
USBD_CDC_SetRxBuffer(&hUsbDeviceFS, &Buf[0]);
USBD_CDC_ReceivePacket(&hUsbDeviceFS);
memset (USBrxbuffer, '\0', 64); // clear the buffer
rxlen = (uint8_t)*Len;
memcpy(USBrxbuffer, Buf, rxlen); // copy the data to the buffer
memset(Buf, '\0', rxlen); // clear the Buf also
USBrxlen = rxlen;
USBrxflag = true;
return (USBD_OK);
/* USER CODE END 6 */
}
The code works fine with STM32F407. I am clearly missing something, any
suggestions will be greatly appreciated. I used the defaults in CubeMX pretty
much, USBD_SELF_POWERED is enabled.
Kind Regards
Mike Zomo
