pjde wrote:I am trying to use DMA to transfer from memory into the peripheral.
What properties do I need to set to transfer 4 bytes at a time to the same destination peripheral register (4 memory locations). If I set the NOINCREMENT flag, won't that only do the transfer on single bytes to the first memory location?
The DMA engines read and write 32bits at a time by default even when reading or writing to or from a peripheral. The details are shown in the BCM2835 ARM Peripherals document for the Transfer Information (TI) register on pages 50 to 52 which says if DEST_WIDTH = 0 use 32-bit destination write width and if DEST_INC = 0 destination address does not change.
The Ultibo API has its own set of DMA data flags (DMA_DATA_FLAG_*) which can be found in the Platform unit and map to these values, so for a memory to peripheral transfer you would use the following flags:
Code: Select all
DMA_DATA_FLAG_DEST_NOINCREMENT or DMA_DATA_FLAG_DEST_DREQ or DMA_DATA_FLAG_SOURCE_WIDE or DMA_DATA_FLAG_NOINVALIDATE
Which tells the DMA don't increment the destination address, use DREQ (data request) signal from the peripheral to control write timing, use wide (128bit) reads from the source address and don't perform cache invalidation on the destination address (because it isn't cached).
I'm assuming you are only wanting TX at present so one channel is all you need, but if you want to do simultaneous TX/RX as described on page 123 of BCM2835 ARM Peripherals then the SPI driver shows a good example of how to do that using two DMA requests and callbacks.