cancel
Showing results for 
Search instead for 
Did you mean: 

sTM32H7 USB HS DMA didnt work

VIvan.1
Associate II

Good day!

I am using stm32h7 with USB3300. For firm use CUBE MX 5.6.1. USB HS CDC VPC class USB with USB DMA Disable - everything works.

As soon as I turn on USB DMA Enable, the device is no longer detected by the PC enumerating failed. Please tell me what could be the problem?

5 REPLIES 5

Where your descriptors and data buffers located?

From CDC_Standalone example for SMT32H743I-EVAL board.

"@Note If the application is using the DTCM/ITCM memories (@0x20000000/ 0x0000000: not cacheable and only accessible

   by the Cortex M7 and the MDMA), no need for cache maintenance when the Cortex M7 and the MDMA access these RAMs.

   If the application needs to use DMA(or other masters) based access or requires more RAM, then the user has to:

       - Use a non TCM SRAM. (example : D1 AXI-SRAM @ 0x24000000)

       - Add a cache maintenance mechanism to ensure the cache coherence between CPU and other masters(DMAs,DMA2D,LTDC,MDMA).

       - The addresses and the size of cacheable buffers (shared between CPU and other masters)

        must be properly defined to be aligned to L1-CACHE line size (32 bytes). "

" /* Be aware that enabling DMA mode will result in data being sent only by

  * multiple of 4 packet sizes. This is due to the fact that USB DMA does not

  * allow sending data from non word-aligned addresses. For this specific

  * application, it is advised to not enable this option unless required. */"

VIvan.1
Associate II

Now I moved descriptors and data buffers to D1 memory, unfortunately enumerate failed again, is it necessary to somehow change the project from the cube to set the descriptions align 4 bytes? Does exist some example for H7 series with DMA enable CDC class?

berendi
Principal

CubeMX will not assist you in this, but rather get in the way.

Try setting the memory holding the buffers non-cacheable

https://community.st.com/s/question/0D70X000007Q6Aw/stm32f7-using-spi-slave-with-dma-to-set-a-flag-ie-no-interrupts

also note that the usb driver has some internal buffers holding the device descriptors and whatnot, which should be moved to DMA capable memory as well. You have to dig somewhat deeper into the USB drivers to do that.

VIvan.1
Associate II

Thanks a lot for your answers! may be you tell me about erratta or app notes to resolve my problem?

MGuth.2
Associate

See https://github.com/STMicroelectronics/STM32CubeF7/issues/8#issuecomment-2103333396

Where I have worked thru most of the issues for my application.