AtXMega and DMA

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have an array:

const unsigned char sequence[] = {0,1,2,3,4,5,6,7,8,9};

And I want to transfer each element of the array to a port output using DMA over a period of time and then repeat over and over.

I setup the DMA trigger source on a timer compare match flag. And the idea is that I will iterate through the array and transfer each element to the output port without CPU intervention.

I have everything configured and the timer and DMA work, except I don't know how to reset the compare match interrupt flag I use for the DMA trigger without CPU intervention. Currenly the flag gets set and stays set and the DMA is always transfering (instead of on an interval).

My hope was to eventually play an audio file using the DAC. So I would use the CPU to set up the registers and let the compare match timer and DMA transfer the data to the DAC at 22kHz or whatever without bothering the CPU.

Any ideas?

Does the DMA need to use the timer to clear the flag (and therefor the whole idea will not work)?

Perhaps there is another way to accomplish the same thing?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm thinking I may need to use the event system to accomplish this.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, the event system was the answer.