6 Replies Latest reply on Mar 3, 2015 2:24 PM by WaMa_286156

    DMA from DelSig to Memory, 4 TD's


        I'm trying to dma from ADC DelSig into memory, chained.  I used the DMA tool to generate the code.


        Bringing the ADC EOC out to a pin shows it is bouncing, but I never get an ISR notification of DMA complete.


        I think I'm doing something wrong. Here is the code and a picture of the schematic.  


        Any suggestions as to what I'm doing wrong and how to fix?


        Pic of the schematic under question is attached


      #include <project.h>




      /* Variable declarations for DMA_1 */


      /* Move these variable declarations to the top of the function */


      uint8 DMA_1_Chan;// the handle for this DMA unit


      int finishedDMA_1;      // set to 1 when the DMA is irq is triggered


      uint8 DMA_1_State;      // current state of the DMA unit


      uint8 DMA_1_TD_InUse;   // which TD is in use currently (filled in at DMA Complete interrupt)


      uint8 DMA_1_TD[4];


      int16 WaveForm1a[3750];


      int16 WaveForm1b[3750];


      int16 WaveForm2a[3750];


      int16 WaveForm2b[3750];




      /* DMA Configuration for DMA_1 */


      #define DMA_1_BYTES_PER_BURST 2


      #define DMA_1_REQUEST_PER_BURST 1




      #define DMA_1_DST_BASE (CYDEV_SRAM_BASE)




      void configDMA_1() {


          // init channel


          DMA_1_Chan = DMA_1_DmaInitialize(DMA_1_BYTES_PER_BURST, DMA_1_REQUEST_PER_BURST, 


              HI16(DMA_1_SRC_BASE), HI16(DMA_1_DST_BASE));




          // set up transfer descriptors


          DMA_1_TD[0] = CyDmaTdAllocate();


          DMA_1_TD[1] = CyDmaTdAllocate();


          DMA_1_TD[2] = CyDmaTdAllocate();


          DMA_1_TD[3] = CyDmaTdAllocate();




          // configure td


          CyDmaTdSetConfiguration(DMA_1_TD[0], 3750, DMA_1_TD[1],  TD_INC_DST_ADR | TD_AUTO_EXEC_NEXT);


          CyDmaTdSetConfiguration(DMA_1_TD[1], 3750, DMA_1_TD[2],  TD_INC_DST_ADR | TD_AUTO_EXEC_NEXT);


          CyDmaTdSetConfiguration(DMA_1_TD[2], 3750, DMA_1_TD[3],  TD_INC_DST_ADR | TD_AUTO_EXEC_NEXT);


          CyDmaTdSetConfiguration(DMA_1_TD[3], 3750, DMA_1_TD[0],  TD_INC_DST_ADR | TD_AUTO_EXEC_NEXT);


          // set addresses


          CyDmaTdSetAddress(DMA_1_TD[0], LO16((uint32)ADC_DelSig_DEC_SAMP_PTR), LO16((uint32)WaveForm1a));


          CyDmaTdSetAddress(DMA_1_TD[1], LO16((uint32)ADC_DelSig_DEC_SAMP_PTR), LO16((uint32)WaveForm1b));


          CyDmaTdSetAddress(DMA_1_TD[2], LO16((uint32)ADC_DelSig_DEC_SAMP_PTR), LO16((uint32)WaveForm2a));


          CyDmaTdSetAddress(DMA_1_TD[3], LO16((uint32)ADC_DelSig_DEC_SAMP_PTR), LO16((uint32)WaveForm2b));


          // set initial td


          CyDmaChSetInitialTd(DMA_1_Chan, DMA_1_TD[0]);


          // enable


          CyDmaChEnable(DMA_1_Chan, 1);








      * Function Name: DmaDone






      * Summary:


      *  Handle Interrupt Service Routine. Source - DMA.










          finishedDMA_1 = 1u;


          // pick up current operational prameters


          CyDmaChStatus( DMA_1_Chan,&DMA_1_TD_InUse, &DMA_1_State);




      int main()




          /* Place your initialization/startup code here (e.g. MyInst_Start()) */








              /* Setup the Interrupt connected to the nrq terminal. */


          isr_DMA_1_StartEx(DmaDone);// this call takes the address of our ISR.  isr_DMA_1_Start() assigns default address










           CyGlobalIntEnable;  /* Uncomment this line to enable global interrupts. */










              /* Place your application code here. */