• AVR Freaks

DMA to DCI problem

Author
hybrid_snyper
New Member
  • Total Posts : 15
  • Reward points : 0
  • Joined: 2007/03/04 09:38:46
  • Location: 0
  • Status: offline
2009/06/22 01:25:23 (permalink)
0

DMA to DCI problem

Hi all,

I have a little problem that I can't quite figure out. I have been working from some example code on the microchip website for transferring data from the DMA to the DCI buffers. I wrote a small app that generated a sine wave via a C4353 DAC. With a couple of while loops I have two buffers with data that produced a 1kHz sine on the left channel and the right produced a 2kHz wave.

Now I wish to streamline the operation by passing the data from the DMA to the DCI buffer. I have declared arrays and stored them in the DMA, I am attempting to pass dci1TxBuffA to TXBUF0 and dci1TxBuffA TXBUF1 however for some reason the data from buffer0 is appearing in both TX buffers that I wish to use and second array seems to be ignored.

Could anyone point me in the right direction to correct this problem.

My code below is only missing the the main fuction which calls upon the folowing fuctions.



unsigned int dci1TxBuffA[24] __attribute__((space(dma))) = {..data...};
unsigned int dci1TxBuffA[13] __attribute__((space(dma))) = {..data...};
.
.
.
.

void dma0Init(void)
{
    DMA0CON  =     0x4;  
    DMA0CNT = 0x17;                       
    DMA0REQ = 0x003C;                   

    DMA0PAD = (volatile unsigned int) &TXBUF0;
    DMA0STA= __builtin_dmaoffset(dci1TxBuffA);
   
    IFS0bits.DMA0IF  = 0;            // Clear DMA interrupt
    IEC0bits.DMA0IE  = 1;            // Enable DMA interrupt
    DMA0CONbits.CHEN = 1;            // Enable DMA Channel   
}

void dma1Init(void)
{
   
    DMA1CON =     0x4;
    DMA1CNT = 0x0C;                       
    DMA1REQ = 0x003C;                   

    DMA1PAD = (volatile unsigned int) &TXBUF1;
    DMA1STA= __builtin_dmaoffset(dci1TxBuffB);
   
    IFS0bits.DMA1IF  = 0;            // Clear DMA interrupt
    IEC0bits.DMA1IE  = 1;            // Enable DMA interrupt
    DMA1CONbits.CHEN = 1;            // Enable DMA Channel   
}

void __attribute__((__interrupt__)) _DMA0Interrupt(void)
{
        IFS0bits.DMA0IF = 0;        //Clear the DMA0 Interrupt Flag
}

void __attribute__((interrupt, no_auto_psv)) _DMA1Interrupt(void)
{
       IFS0bits.DMA1IF = 0;        //Clear the DMA1 Interrupt Flag
}

#1

2 Replies Related Threads

    hybrid_snyper
    New Member
    • Total Posts : 15
    • Reward points : 0
    • Joined: 2007/03/04 09:38:46
    • Location: 0
    • Status: offline
    RE: DMA to DCI problem 2009/06/22 03:44:39 (permalink)
    0
    Just thought I would add when I try to use TXBUFF1 and omit TXBUFF0 and the the DMA0 initialise it would appear that the data is not being transferred to TXBUFF1. I am starting to wonder if this is a DCI issue as opposed to DMA.
    #2
    hybrid_snyper
    New Member
    • Total Posts : 15
    • Reward points : 0
    • Joined: 2007/03/04 09:38:46
    • Location: 0
    • Status: offline
    RE: DMA to DCI problem 2009/06/23 07:48:41 (permalink)
    0
    From what I can tell the DCI port seems to be getting a bit carried away, data is being transferred to the TX buffers when I don't expect it. Is there a way to force the DMA count to wait until the data as been transferred to the TX buffers. i thought the CE117 example may of been of some use but it does not seem to be translating very well to my application.

    The only difference I can see with the CE117 example of my own code is that I have declared my buffers as opposed to CE117's method.

    I would appreciate it if someone could help out.
    #3
    Jump to:
    © 2019 APG vNext Commercial Version 4.5