I am trying to get a interrupt on DMA completion. Here are the configuration steps that i am taking, but am not able to get an interrupt on completion - DMA operation happens though.
test_tcd->CSR = DMA_CSR_INTMAJOR_MASK;
EnableIRQ(DMA3_DMA19_IRQn);
I am using channel 3, and this specific test is memory to memory transfer. Do i need to enable any other flags?
Thanks
Hello Santosh
Try adding this line in your code:
test_tcd->CSR |= DMA_CSR_DREQ_MASK;
DREQ[CSR] bit clears automatically ERQ flag when the transference is done (current major iteration count reaches zero), therefore is not necessary clear by software.
About your other question, yes it's possible. DMA_TCDn_DLASTSGA can apply to restore the destination address to the initial value at the completion of the major iteration count. This register allows signed writing, for example, if you need to fill in a Buff[10] and reload with new values at the completion of the major iteration, write DMA_TCDn_DLASTSGA = -10 to return from &Buff[9] direction to &Buff[0].
I hope you succeed.
Regards.
I am using K27.
I have an additional question as well - Can i configure the DMA such that only the destination address is incremented and not the source address. From what i understand now, eDMA engine will update both source and destination address by SLAST. I am attempting to do a SPI to DMA transfer, i can write a constant command to the SPI peripheral, but the response needs to go into a circular queue. Thus only the destination address needs to be updated.
Thanks
Hi
If you set ptrDMA_TCD->DMA_TCD_DOFF to 0 it means the destination address is not incremented.
ptrDMA_TCD->DMA_TCD_SLAST is used to modify the pointer 'after' a complete transfer has terminated (rather than at each transfer). It should also be set to 0 (some devices don't initialise this register to zero at reset so it can have a random value and thus cause strange behavior if not set).
Regards
Mark
uTasker developer and supporter (+5'000 hours experience on +60 Kinetis derivatives in +80 product developments)
Kinetis: http://www.utasker.com/kinetis.html
Hello Santosh
Which MCU are you using?