Hi to you all,
I've search the web (having a thread going on ARM Connected Community), read the manual, tried LPCOpenV2.20 (last available) and tried my code too, but: I'm still unable to trigger a memory-to-memory DMA transfer using a timer as a trigger.
LPCOpen provides an example which is similar to what I'm trying to do: "DMA example using a timer capture input as a trigger", actually I'm trying to use a timer match as a trigger.
The setup function looks like this (Note that the //comments are not mine):
/* Setup DMA M2M transfer to trigger on timer match */
static void setupDMATrigger(void)
/* Initialize GPDMA controller */
/* Get DMA channel */
dmaCh = Chip_GPDMA_GetFreeChannel(LPC_GPDMA, GPDMA_CONN_MAT0_0);
/* Setup DMA transfer */
(uint32_t) &source, GPDMA_CONN_MAT0_0, //(uint32_t) &dest,
// Chip_GPDMA_Stop(LPC_GPDMA, dmaChSSPTx);
/* Enable GPDMA interrupt */
But then in the main function:
int numDmaXfers = 0;
/* Setup tiemr capture input used for DMA trigger */
/* Setup timer for match event on each capture event */
/* Setup DMA for memory to memory transfer on timer match event */
/* Enable timer interrupt */
... etc, etc ...
The function is grayed out!
The timer has it's own setup, but I believe that's not critical, the manual states this about DMA Operation (Chapter 32, sec. 32.7.2):
DMA requests are generated by 0 to 1 transitions of the External Match 0 and 1 bits of
each timer. In order to have an effect, the GPDMA must be configured and the relevant
timer DMA request selected as a DMA source via the CREG block, see Table 101.
So it looks to me, that the timer just keeps going and the DMA must "sense" the timer REQ. That makes well.. sense.
The problem is in the Chip_GPDMA_Transfer call: GPDMA_CONN_MAT0_0 is not the destination. And I believe &dest was correct.
How am I supposed to connect the peripheral to DMA in a way such that it triggers the transfer, but it is not the source nor the destination (because actually it isn't)?
Any help would be highly appreciated, and I'll attach both the example 's source and the user manual for your reference.
Original Attachment has been moved to: cr_startup_lpc43xx.c.zip
Original Attachment has been moved to: sysinit.c.zip
Original Attachment has been moved to: periph_dma_timertrig.c.zip