6 Replies Latest reply on Sep 11, 2012 9:38 PM by sukvasant.tantikovit

    ADC Filter VDAC

    sukvasant.tantikovit

      I modified the ADC Filter VDAC example to have an additional DMA for transferring data from filter to VDAC. The project is attached. I compiled it and downloaded to PSoC3 030 board. The DMA for ADC to Filter input is operating, but DMA for Filter to VDAC.

        • 1. Re: ADC Filter VDAC
          user_14586677

          I must be blind but I do not see setup code for DMA_Filter ?

             

           

             

          Also its trigger is set for "Level", should that be edge or derived ?

             

           

             

          Regards, Dana.

          • 2. Re: ADC Filter VDAC
            user_14586677

            Are you trying to modify the ADC to Filter project by adding DMA instead of ISR

               

            to service VDAC from filter output ? If so you need to config and setup the

               

            DMA_Filter block.

               

             

               

            Regards, Dana.

            • 3. Re: ADC Filter VDAC
              sukvasant.tantikovit

              Setup for DMA_Filter is in DMA_Config() as below.

                 

              void DMA_Config(void)
              {
                  /* Declare variable to hold the handle for DMA channel */
                  uint8 channelHandle;
                  uint8 channelFilter;
                 
                  /* Declare DMA Transaction Descriptor for memory transfer into
                   * Filter Channel.
                   */
                  uint8 tdChanA;
                  uint8 tdFilter;
                 
                  /* Configure the DMA to Transfer the data in 1 burst with individual trigger
                   * for each burst.
                   */
                  channelHandle = DMA_DmaInitialize(BYTES_PER_BURST, REQUEST_PER_BURST,
                                                      HI16(UPPER_SRC_ADDRESS), HI16(UPPER_DEST_ADDRESS));      
                  channelFilter = DMA_DmaInitialize(BYTES_PER_BURST, REQUEST_PER_BURST,
                                                      HI16(UPPER_SRC_ADDRESS), HI16(UPPER_DEST_ADDRESS));
                 
                  /* This function allocates a TD for use with an initialized DMA channel */
                  tdChanA = CyDmaTdAllocate();                                                      
                  tdFilter = CyDmaTdAllocate();
                 
                  /* Configure the tdChanA to transfer 1 byte with no next TD */
                  CyDmaTdSetConfiguration(tdChanA, 1, tdChanA, DMA__TD_TERMOUT_EN);            
                  CyDmaTdSetConfiguration(tdFilter, 1, tdFilter, DMA__TD_TERMOUT_EN);
                 
                  /* Set the source address as ADC_DelSig and the destination as
                   * Filter Channel A.
                   */
                  CyDmaTdSetAddress(tdChanA, LO16((uint32)ADC_DelSig_DEC_SAMP_PTR), LO16((uint32)Filter_STAGEAH_PTR));     
                  CyDmaTdSetAddress(tdFilter, LO16((uint32)Filter_HOLDA_PTR), LO16((uint32)VDAC8_Data_PTR));
                 
                  /* Set tdChanA to be the initial TD associated with channelHandle */
                  CyDmaChSetInitialTd(channelHandle, tdChanA);                                         
                  CyDmaChSetInitialTd(channelFilter, tdFilter);
                 
                  /* Enable the DMA channel represented by channelHandle and preserve the TD */
                  CyDmaChEnable(channelFilter, 1);
                  CyDmaChEnable(channelHandle, 1);    
                 
                  //Filter_COHER_REG = 0xAA;
                  Filter_SetCoherency(Filter_CHANNEL_A, 0xAA);
                 
              }

              • 4. Re: ADC Filter VDAC
                user_14586677

                I see two DMA objects on your schematic page, "DMA" and "DMA_Filter".

                   

                 

                   

                In DMA_Config I see you only handle "DMA" object ? For example I never see you use -

                   

                 

                   

                 

                   

                uint8 DMA_Filter_DmaInitialize(uint8 BurstCount, uint8 ReqestPerBurst, uint16 UpperSrcAddress, uint16 UpperDestAddress) ;

                   

                 

                   

                 

                   

                Regards, Dana.

                • 5. Re: ADC Filter VDAC
                  sukvasant.tantikovit

                  Thanks! Let me try.

                  • 6. Re: ADC Filter VDAC
                    sukvasant.tantikovit

                    It is working now.