2022-02-07 05:13 AM
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 !
2022-02-07 05:59 AM
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.
The USB FIFO should be able to use DMA
The 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.
2022-02-07 06:03 AM
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.
2022-02-07 06:03 AM
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.
2022-02-07 06:06 AM
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.