In the attached project the eDMA Major count completion interrupt service routine gets called twice after one transfer is done.
The example simply copies the first 10 elements of sourceBuffer
to the first 10 elements of destinationBuffer using PIT CH0
trigger (every 0.5 seconds) and fires an interrupt when finished.
Every ISR run increments a counter.
After the interrupt fired the buffers and the counter are printed to the
If you just run the attached example code the eDMA ISR will be called twice,
but there was only one eDMA transfer. You can see this in terminal if you
check the debug uart output. destinationBuffer to destinationBuffer
are still 0xff (initial value) therefore only one complete transfer of
10 bytes was done.
If you call EDMA_ClearChannelStatusFlags twice in ISR (uncomment line 71)
the ISR will be called only once. This also happens if you add a delay after
clearing edma status flags or you can also just check if the edma
transfer is really done by calling EDMA_GetChannelStatusFlags.
It seems that only a little bit of delay needs to be added to the ISR and
it will be called only once but I think making the ISR take longer
on purpose is not a good idea (usually you keep your ISRs as short as
Why does the eDMA ISR DMA0_DMA_CH_INT_DONE_0_IRQHANDLER get called twice if I do not put any more code in it?