cancel
Showing results for 
Search instead for 
Did you mean: 

USB HS CDC stop working if Internal IP DMA is enabled on STM32H750

TQin.1
Associate

Project created by the latest version of CubeMX with the latest HAL libraries with almost no user code yet, only USB HS with external phy and USB CDC middleware enabled. Heap size and stack size are all set to 0x0800.

There is a USB3300 and an external SDRAM connected to H750. The SDRAM works fine. The device enumerated successfully and I can get the virtual COM port opened under windows. However, if I want to send data buffered in SDRAM to PC by calling CDC_Transmit_HS() function, the transmission stucks after about hundreds or thousands of bytes were sent. The total number of bytes that can be sent varies depending on the length parameter in CDC_Transmit_HS() function, and results below:

in total of 347 bytes can be sent if calling CDC_Transmit_HS() with length parameter of 1

in total of 1440 bytes can be sent if calling CDC_Transmit_HS() with length parameter of 8

in total of 1152 bytes can be sent if calling CDC_Transmit_HS() with length parameter of 384

in total of 1536 bytes can be sent if calling CDC_Transmit_HS() with length parameter of 512

EP1 keeps enabled when the transmission stops, and OTG_DIEPTSIZ0 register seems to be leaved in a wrong state that XFRSIZ is 0 but PKTCNT isn't 0. The CDC_DataIn callback will not be called then, so the CDC_Transmit_HS() function will always return USBD_BUSY.

I tried triggering the DMA transmit manually by modifying the register of USB HS, setting the correct OTG_DIEPDMA2, OTG_DIEPTSIZ0 in the IDE after enumeration, the result was all the same: the first 3 times of manual transmission of 512 bytes succeed and the fourth try failed.

If I disabled the IP Internal DMA, the USB CDC virtual COM port works fine(regarding some data loss that I will debug later), all data can be sent continuously at a speed of approximately 5MB/s.

So is there anything wrong with me or CubeMX or the USB DMA controller of STM32H750? How can I use the USB HS CDC with internal IP DMA? The chip is already in revision V.

Looking forward to any suggestion and thanks.

0 REPLIES 0