2013-05-14 02:02 PM
Is it possible to use DMA for USB transfers? My understanding of the STM32 DMA controller is that it will transfer data from one place to another without CPU usage. If I were moving data from RAM to a DAC output, I can easily see (and have coded) this. But for transfer out to a USB peripheral, I would think that the CPU would be needed to operate the USB interface. Is this correct?
I am trying to read from one high-speed interface (~8MBd) and transfer the data via USB. I would like to use the DMA USB transfer at the same time as I am using the CPU to read in the next set of data. Is this possible? Thanks. -- Chris #stm32f2072013-06-14 08:05 AM
yes, I have exactly same question. Can STM32 USB do bulk HS transfers directly from external memory without loading CPU? (that would involve DMA obviously).
Has anybody tried anything similar?2013-06-14 09:11 AM
It strikes me that the USB FIFO buffers are accessible by the DMA controller. DMA2 in M2M?
2013-06-15 10:31 AM
STM32F2/F4 OTG_HS core has an embedded DMA controller, which connects to SRAM1,SRAM2 and FSMC over the multi-layer AHB. As the default, STM32_USB-Host-Device_Lib_V2.1.0 enables this DMA for OTG_HS. In this version, the DMA transfer occurs in the unit of packet (transaction). Though the data tranfser is done by DMA, ARM core intervention is still required to start/finish each transaction, to set up OTG_HS registers (the stack code takes care of this process at all).
> I would like to use the DMA USB transfer at the same time as I am using the CPU to read in the next set of data. Is this possible? You may apply double buffer or a cyclic buffer. While the ARM core preares the next packet, pass another (portion of) buffer to DCD_EP_Tx(). DCD_EP_Tx() accepts any size of transfer, even greater than MPS (Max Packet Size) of the bulk endpoint. https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=%2Fpublic%2FSTe2ecommunities%2Fmcu%2FLists%2Fcortex_mx_stm32%2Fstm32f207%20usb%20%20only%20multiple%20of%2064%20bytes%20can%20be%20send> Can STM32 USB do bulk HS transfers directly from external memory without loading CPU? Set up FSMC for an external SRAM. Pass a buffer on the FSMC address space to DCD_EP_Tx() or DCD_EP_PrepareRx() Tsuneo