cancel
Showing results for 
Search instead for 
Did you mean: 

Is DMA possible with USB FS

BDELI.2
Associate II

I'm working on a STM32H750XB with USB. It works fine with the USB2_OTG_FS instance, but the speed is not reaching the maximum (only 875kB/s). I'm using the USB with diskio, FatFS and FreeRTOS.

I'd like to enable DMA to make it faster, so I set

hhcd.Init.dma_enable = 1;

and I also disable DCache.

But when it's set like this, the device crashes when the USB is getting enumerated.

Is it really possible to enable DMA on USB FS ?

Thanks !

4 REPLIES 4

What do you think the maximum speed for a USB FS MSC should be?​

The interface is going to be most efficient doing high block count aligned transfers. FatFS doesn't have any inherent block caching or lazy-write algorithm. f_read / f_write need to be used with an awareness of underlying media expectation. doing many small transaction will be particularly slow.​

T​he USB FIFO should be able to use DMA

T​he H750 should be able to uses it's D-Cache, expect to have to manage coherency, either directly or by using specific memory areas you've set to be non-cacheable.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
BDELI.2
Associate II

The max speed for USB FS is 1.5MB/s in the most ideal case, according to the specification, so I wanted to be the closest as possible to this value.

I'm doing "big" transactions, an f_read of ~65kB.

TDK
Guru

Clock speed != max data transfer speed.

yes, DMA can be used, provided you manage cache appropriately.

Sending more data per transfer is going to more efficient.

Should be able to get around 1 MBps transfer rate if you are quick to reinitiate transfer after the last one succeeds.

If you feel a post has answered your question, please click "Accept as Solution".
BDELI.2
Associate II

What needs to be changed to move from non-DMA to DMA USB ?

I did the

hhcd.Init.dma_enable = 1;

and also changed usb_diskio to usb_diskio_dma.