cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H743 nucleo in USB OTG FS with internal DMA

Marina Brener
Associate III
Posted on November 10, 2017 at 20:25

Hello,

Trying to create a USB with internal DMA using the CubeMX for the H743 nucleo, not luck so far.

It works fine without the Internal DMA!

I set the Enable internal IP DMA to Enable in the Cube and now the device won�t enumerate.

What is missing to enable the internal DMA of the usb?

I looked at the LwIP_HTTP_Server_Netconn_RTOS example and USB_Device/CDC_Standalone (that uses HS CDC with UART and DMA ) example but I am new to the DMA subject.

Can anyone point me in the right direction? 

Thanks!

#stm32h743 #stm32-usb-dma #stm32h7
4 REPLIES 4
Joerg Wagner
Senior III
Posted on November 10, 2017 at 23:38

Where is your memory located?

I guess the address resides in DTCMRAM (0x20000000-0x20020000) and this will not work.

Take a look in the file 'output.map'.

There is no interconnection from DTCMRAM to the DMA Controller. (page 100 in RM0433)

You have to define a .section in the linker script when using SW4STM32 or an assignment in the code if using IAR or Keil. Or set the start address of your application to 0x24000000 (SRAM1).

Posted on December 02, 2017 at 23:43

I'm in same (USB_OTG_HS is not work then IP DMA enabled) problem.

Memory for buffers allocated in range from 0x24000000, initial enuberation (EP0 ib action) is complete.

DCache enabled or disabled - is no difference. DCache clean/invalidate added to proper places.

I see strange vales in cube-generated code in GAHBCFG setup (USB_CoreInit function). Combination of USB_OTG_GAHBCFG_HBSTLEN_1 and USB_OTG_GAHBCFG_HBSTLEN_2 results as invalid value.

Posted on December 03, 2017 at 00:24

 RCC->AHB2ENR |= RCC_AHB2ENR_D2SRAM1EN;

 (void) RCC->AHB2ENR;

 RCC->AHB2ENR |= RCC_AHB2ENR_D2SRAM2EN;

 (void) RCC->AHB2ENR;

 RCC->AHB2ENR |= RCC_AHB2ENR_D2SRAM3EN;

 (void) RCC->AHB2ENR;

added to initialization... no effect

Ben K
Senior III
Posted on December 05, 2017 at 20:29

The OTG's internal DMA works with 32 bit aligned addresses, therefore when an unaligned buffer is passed, the DMA will copy unintended values to the beginning of the message. This is prevented in most cases by using the __ALIGN_BEGIN and __ALIGN_END macros, however there are cases where this precaution isn't made. Since the failure occurs at enumeration I suggest that you look at the invocations of USBD_CtlSendData() in the code, find the places where an unaligned address is passed as parameter 2, and debug which of those gets called actually. Share the results here.