Skip to main content
Visitor II
June 12, 2017
Question

STM32F7 USB Device HS DMA enabled

  • June 12, 2017
  • 7 replies
  • 4227 views
Posted on June 12, 2017 at 17:14

I'm working on the audio example and I've made it work with Audio Class 2.0. Device enumerates and ISO packets are received.

However when I decided to enable DMA for better performance the TX line is not working. Device receives Setup packets, but cannot transmit.

In the generated from CubeMX code I saw the following:

// 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.

Does somebody knows how 'large' is one packet or where that is defined?

Anyone bumped into that problem?

Using: 

 - System Workbench for STM32

 - STM32Cube_FW_F7_V1.7.0

#stm32-usb-dma #stm32-usb #stm32 #stm32f7
    This topic has been closed for replies.

    7 replies

    Visitor II
    May 4, 2018
    Posted on May 04, 2018 at 05:22

    I have the same problem here with STM32H743, when USB DMA is disabled, both transmit and receive isochronous transfers are working fine, but with DMA enabled, receive still works, but isochronous transmit doesn't, resulting in empty packets being sent to PC. The transmit and receive buffers are defined back-to-back in the same structure, which is placed in SRAM1 with 4-byte alignment.

    Control transfers through endpoint 0 apparently works as the device enumerates properly, but isochronous transmit simply fails, as if the DMA was not active. 

    Is there any special procedure to initialize the DMA transmit for isochronous end points, that the driver did not implement properly?

    The HAL drivers are version 1.1.0 for STM32H7. 

    Visitor II
    May 24, 2018
    Posted on May 24, 2018 at 10:08

    Hi

    I cannot enumerate, it returns error if UAC2 descriptor is inserted. Do you have a valid device descriptor? or is there something to change other than device qualifier and device descriptor?

    Visitor II
    May 24, 2018
    Posted on May 24, 2018 at 14:32

    You can find some examples of UAC2 descriptors online, such as from one NXP document:

    https://www.nxp.com/docs/en/user-guide/USBUG.pdf

    Alternatively, if you have access to a device that implements UAC 2.0, such as XMOS based USB devices, you can copy their descriptor using some USB descriptor viewers and use as a reference.

    If you have enumeration problems, you can also use a descriptor viewer to check for mistakes.

    Although, the USB DMA problem remains unsolved...

    Visitor II
    May 24, 2018
    Posted on May 24, 2018 at 19:39

    Hi Chen

    thanks for the reply

    I started from a cube project and it works in UAC1, then I replaced the descriptors. The board is recognized but with errors.

    Here the project

    https://we.tl/zINKkNBEsx

     

    I don't understand where is the error

    Visitor II
    October 9, 2018

    Any chance this has been solved?

    I'm using the STM32H743I-Eval board, and I've got the USB external PHY working at HighSpeed however I need to get it working with DMA, I've switched ​.dma_enable to true, however now it fails at the device descriptor stage.

    Any ideas how I can fix (or atleast debug) this?

    Visitor II
    December 19, 2018

    ST now has a number of discovery and other boards with USB HS OTG/Device (either with external or internal PHY) and all examples seem to be the now very old USB Audio Class 1.0. Hopefully UAC 2 will be forthcoming, and since at least two boards now have 4 microphones on-board, hopefully those examples will support 4 channel audio capture! And please with DMA, and 24-bit samples and at least 48 kHz or more! Thanks for the great drivers and examples, keep them coming!

    Visitor II
    December 5, 2019

    hi,did you solve the problem of transimting with dma mode?

    Visitor II
    July 14, 2020

    Hello, Momchil Stanchev!

    I am working on Audio Class 2.0 device but could not get it working yet. Could you please share your source code regarding USB Audio Class 2.0?

    Visitor II
    July 28, 2020

    Hi, I will try it in the next few days, too.

    It says "... data being sent only by multiple of 4 packet sizes." So what is your packet size?