I'm hoping for some advice and a general point in the right direction.
I have a 3.5" TFT display driven in 8080 mode (16-bit parallel bus) which at present works well although the display flickers somewhat when performing large updates to the screen.
I've been reading that using DMA would speed things up however I've never used DMA before and I'd appreciate some advice on how this would benefit me and also how I would go about implementing this for my 16-bit parallel bus.
Any information would be greatly received.
Solved! Go to Solution.
Note that the DMA engine is NOT inherently 'faster' than the MCU core. That is, the microcode that runs the control and pointer operations for DMA don't really run any faster than the same kinds of instructions in an optimized MCU loop. The particular advantage of DMA is if the CPU can get 'other work' done during the transfer.
I have used the example code you supplied and it works fine. Then I have tried to adapt it to send more data but it does not behave as expected. I have allocated to arrays:
Then I set the source destination registers like this:
DMA_TCD0_SADDR = (uint_32)source;
DMA_TCD0_DADDR = (uint_32)destination;
When I try to copy the data, more data is copied than what I want. For instance, if I set registers like this:
DMA_TCD0_SOFF = 0x04;
DMA_TCD0_ATTR = DMA_ATTR_SSIZE(2) | DMA_ATTR_DSIZE(2);
DMA_TCD0_NBYTES_MLNO = 0x04;
DMA_TCD0_DOFF = 0x04;
DMA_TCD0_CITER_ELINKNO = DMA_CITER_ELINKNO_CITER(1);
DMA_TCD0_BITER_ELINKNO = DMA_BITER_ELINKNO_BITER(1);
I would expect that 4 bytes would be copied, but instead 20 bytes are copied.
If I then change the minor byte count register like this:
DMA_TCD0_NBYTES_MLNO = 0x08;
I would expect that 8 bytes would be copied, not 64 bytes, that actually is copied.
I must have misunderstod something, can someone explain the behaviour I see?