2 Replies Latest reply on Mar 24, 2011 3:31 AM by david.meinel

    ADC_SAR -> DMA -> FIR_Filter

    tim.frhlich

      Hello everyone,

         

      I'm working with the PSoC5 Dev-Kit CY8CKIT-001 and PSoC Creator 1. I try to transfer the result of the ADC_SAR to the filter-block via DMA. My DMA config is: 

         

       /* DMA Configuration for DMA_ADC2Filter */
          #define DMA_ADC2Filter_BYTES_PER_BURST 2
          #define DMA_ADC2Filter_REQUEST_PER_BURST 1
          #define DMA_ADC2Filter_SRC_BASE (CYDEV_PERIPH_BASE)
          #define DMA_ADC2Filter_DST_BASE (CYDEV_PERIPH_BASE)
          DMA_ADC2Filter_Chan = DMA_ADC2Filter_DmaInitialize(DMA_ADC2Filter_BYTES_PER_BURST, DMA_ADC2Filter_REQUEST_PER_BURST,
              HI16(DMA_ADC2Filter_SRC_BASE), HI16(DMA_ADC2Filter_DST_BASE));
          DMA_ADC2Filter_TD[0] = CyDmaTdAllocate();
          DMA_ADC2Filter_TD[1] = CyDmaTdAllocate();
           if(DMA_ADC2Filter_Chan == DMA_INVALID_TD || DMA_ADC2Filter_TD[0] == DMA_INVALID_TD)
          {
                 LCD_Position(0,0) ;
              LCD_PrintString("DMA Error") ;
          }
          
          if (CyDmaTdSetConfiguration(DMA_ADC2Filter_TD[0], 2, DMA_ADC2Filter_TD[1], TD_INC_SRC_ADR | TD_INC_DST_ADR | TD_SWAP_EN | TD_SWAP_EN ) != CYRET_SUCCESS) // c);
          {    
              LCD_Position(0,0) ;
              LCD_PrintString("DMA Error") ;
          }
          
          if (CyDmaTdSetConfiguration(DMA_ADC2Filter_TD[1], 2, DMA_ADC2Filter_TD[0], TD_SWAP_EN ) != CYRET_SUCCESS)
          {    
              LCD_Position(0,0) ;
              LCD_PrintString("DMA Error") ;
          }
          CyDmaTdSetAddress(DMA_ADC2Filter_TD[0], LO16((uint32)ADC1_SAR_WRK0_PTR), LO16((uint32)FIR_Filter_STAGEA_PTR));
          CyDmaTdSetAddress(DMA_ADC2Filter_TD[1], LO16((uint32)ADC1_SAR_WRK1_PTR), LO16((uint32)FIR_Filter_STAGEA_PTR));
          CyDmaChSetInitialTd(DMA_ADC2Filter_Chan, DMA_ADC2Filter_TD[0]);
          if (CyDmaChEnable(DMA_ADC2Filter_Chan, 1) != CYRET_SUCCESS)
          {    
              LCD_Position(0,0) ;
              LCD_PrintString("DMA Error") ;
          }

         

      I took the config from the example and it works fine for the lower byte. But not for the higher one. The problem is that the result of the conversion is stored in two different registers of just 1 byte, not as in the example in one 16 bit-register. I gues the ardesspointers need to be configured in a certain way, but I don't know how.

         

      Can anyone tell me how? 

         

      Thanks in advance! 

         

      timhappy