cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F7 USB Device HS DMA enabled

Momchil Stanchev
Associate
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
11 REPLIES 11
greatbena
Associate II
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. 

dodotronic
Associate II
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?

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

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

Posted on May 27, 2018 at 03:48

Just making sure, does your board include a USB HS physical layer? Neither STM32F7 nor STM32H7 provide an integrated USB high speed PHY, so you will need an external IC to use USB high speed mode. Typically UAC 2.0 is implemented in USB high speed mode.

Posted on May 27, 2018 at 07:48

I'm using STM32F769I-DISC1 with integrated PHY. However the USB audio class 2 is indipendent from the USB speed. In fact the UAC2 (as well as UAC1) can be used both with high speed USB (480Mbps) and full speed (12Mbps) with the obvious speed limitations. I started from the CUBE project with UAC1 high speed but when I change the descriptors there's something that goes wrong.

patrick2
Associate II

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?

PaulCox
Associate II

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!

hwit.2035
Associate

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