AnsweredAssumed Answered

USB CDC buffer initialization

Question asked by Lecheng Zhang on Jul 13, 2018
Latest reply on Jul 20, 2018 by Lecheng Zhang

Hi,

  

I'm using K70 with MQX system and USB CDC as virtual COM port to send data. From time to time, I can see 12 bytes of data corruption within the sent data package from the receive side. I checked the buffer used to send data by calling USB_Class_CDC_Send_Data() and found that the buffer is allocated by malloc(). I changed the initialization by calling the function in MQX library _mem_alloc_uncached() and the data corruption went away.

  

I tried to look for the reference on the reference manual about data buffer used in USB transaction but I couldn't find anything. Is there any recommendations on the buffer used in USB has to be allocated in the uncached memory? I want to make sure my change was not just shifting the timing and drive the real problem elsewhere.

  

The USB is configured in high-speed mode and use a bulk size of 512. USB is running in device mode using EHCI as device controller. Our hardware board is using a USB3300 PHY.

  

Thanks in advance!

  

Best Regards,

Lecheng

Outcomes