Peripheral to Peripheral DMA on Xmega32e5

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

Greets Freaks!

 

As I continue my exploration of this family of AVR's I came across the EDMA and I see it allows for Peripheral to Peripheral transfers.  I actually have an application where this would be useful, but I am having a helluva time trying to set it up through Atmel Start, but I am getting a little stumped.  I have read Atmel AVR1304: Using the XMEGA DMA controller, and from that it seems that the only thing I can do is peripheral to memory and vice versa.

 

I am looking to do a simple pass through from the One USART to the Other.  RX0 to TX1 and RX1 to TX0.  9600 baud for the sake of testing is fine.

 

Am I screwed?

 

JIm

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB user

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

A little disappointing is that there is a difference between the xmegaA series DMA and the xmegaE series EDMA, and EDMA can not perform infinite transfer repetitions.
It is necessary to restart the EDMA by monitoring the number of transfers by interrupt or polling.

If it is good, it is possible to echo back to take DMA of the received data with the following code.
 

void edma_init(void){
    // EDMA0(USRATC0) INIT ---------------------------------------------
    // EDMA Trigger Source
    EDMA.CH0.TRIGSRC = EDMA_CH_TRIGSRC_USARTC0_RXC_gc;
    // EDMA Transfer Count
    EDMA.CH0.TRFCNT = 0;    // 65536byte
    // EDMA Address Control
    EDMA.CH0.ADDRCTRL = EDMA_CH_RELOAD_NONE_gc | EDMA_CH_DIR_FIXED_gc;
    // EDMA Memory Address
    EDMA.CH0.ADDR = (uint16_t)&USARTC0.DATA;
    // EDMA Single Shot Data Transfer ENABLE
    EDMA.CH0.CTRLA = EDMA_CH_ENABLE_bm | EDMA_CH_SINGLE_bm;
}

 

and polling

 

int main(){
    comm_init();
    edma_init();

    while (1){
        if (!(EDMA.CH0.CTRLA & EDMA_CH_ENABLE_bm)){
            EDMA.CH0.CTRLA = EDMA_CH_ENABLE_bm | EDMA_CH_SINGLE_bm;
        }
    }
}

 

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

Thanks, but The above code does not show how to connect the two usarts together to allow data to pass from one to the other.

 

And from what I see in your explanation it would appear that this is not entirely CPU independent either.

 

JIm

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB user

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

I have shown it as a simple echo back to illustrate the initialization and use of EDMA as simply as possible.

Therefore, initialization of USART was also omitted.

If you want to cross, you can rewrite the transfer destination to USARTD0.DATA.
The other would be to use EDMA.CH1.

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

I'll give it a go tomorrow.  Thanks for the tips

 

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB user