AnsweredAssumed Answered

STM32L0 USB CDC VCP Transmit problems

Question asked by Nick on Dec 28, 2014
Latest reply on Apr 29, 2016 by FTITI.Walid
I am using an STM32L053 part and trying to use the USB CDC VCP functionality on an STM32L0-Discovery board. In the past I've gotten the USB CDC VCP functionality working on an STM32F4 on a custom board using the ST USB Library. 

For the STM32L0 project I am using the STCubeMX. The first problem I encountered was the CDC receive would not work until I called USBD_LL_PrepareReceive.
That was well documented in this link: CDC Receive Problems

Now I am having problems with the CDC transmit. If I transmit 8 bytes or less the data is transmitted correctly. For example, I've been transmitting 12345678 and that comes out correctly. Keep in mind these are ASCII strings. Now if I try and transmit 123456789 I get 9 bytes of garbage. I've traced the code all the way down to PCD_WritePMA function. At that point it is still pointing to my buffer of data and the length is 9 bytes. I see it correctly grab the data and join it into 16-bits of data and then write it to memory location 0x40006000 which is the USB 512x16-bit SRAM section. 

I've attached a screen shot from a USB protocol analyzer that shows the garbage data. Has anyone seen this before?