cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 5, 3 & 1 MCU

Anonymous
Not applicable

Hi

   

I am trying to do an application that takes a certain number of samples using ADC and DMA. I did an experiment by looking at the application in AN61102. DMA Transfer Done interrupt not working.

   

This is my main.c file

   
    

/* ========================================
 *
 * Copyright YOUR COMPANY, THE YEAR
 * All Rights Reserved
 * UNPUBLISHED, LICENSED SOFTWARE.
 *
 * CONFIDENTIAL AND PROPRIETARY INFORMATION
 * WHICH IS THE PROPERTY OF your company.
 *
 * ========================================
*/
#include "project.h"
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

    

#define SAMPLES                    128            

    

uint16 ADC_sample[SAMPLES]={0};

    

void ADC_DMA_Config(void);

    

/*   ADC DMA Interrupt Handler   */
CY_ISR(DMA_TC_ISR)
{
   LED1_Write(~LED1_Read());
}

    

int main(void)
{
  
    CyGlobalIntEnable; /* Enable global interrupts. */
    //this will initially start the timer

    

    LCD_Start();
    
    ADC_DMA_Config();
    
    LCD_Position(0u, 0u);
    LCD_PrintString("ADC DMA Test");
    
    for(;;)
    {
   
    }
}

    

void ADC_DMA_Config(void)
{
    /* DMA Configuration for DMA */
    #define DMA_BYTES_PER_BURST 2
    #define DMA_REQUEST_PER_BURST 1
    #define DMA_SRC_BASE (CYDEV_PERIPH_BASE)
    #define DMA_DST_BASE (CYDEV_SRAM_BASE)  
    
    uint8 DMA_Chan;
    uint8 DMA_TD[1];
    
    DMA_TC_ISR_StartEx(DMA_TC_ISR);
    
    /* DMA Initialization - 2 byte per trigger. Each burst transfer
     * needs a new request. Set upper source and destination address. */    
    DMA_Chan = DMA_1_DmaInitialize(DMA_BYTES_PER_BURST, DMA_REQUEST_PER_BURST, 
                                 HI16(DMA_SRC_BASE), HI16(DMA_DST_BASE));    
     /* Allocate TD */
    DMA_TD[0] = CyDmaTdAllocate();
    
    /* Destination address is incremented after each transaction and 
     * Term out generated after the specified no. of bytes are transferred 
     * to memory. Tranfer the specified number of samples and generate 
     * term out */
    CyDmaTdSetConfiguration(DMA_TD[0], (2 * SAMPLES), DMA_TD[0], 
                            DMA_1__TD_TERMOUT_EN | TD_INC_DST_ADR);     
    
    /* Set source and destination address */
    CyDmaTdSetAddress(DMA_TD[0], LO16((uint32)ADC_DelSig_1_DEC_SAMP_PTR), 
                            LO16((uint32)ADC_sample));    
    /* Set the intial TD for the channel */
    CyDmaChSetInitialTd(DMA_Chan, DMA_TD[0]);
    
    ADC_DelSig_1_Start();
    
    /* Start the ADC conversion */
    ADC_DelSig_1_StartConvert();
}

   
   

That's all my settings. Is there a place I made wrong?

   

Best Regards

0 Likes
1 Solution
odissey1
Honored Contributor II

Mucit123, are you missing DMA enable call?

   

CyDmaChSetInitialTd(DMA_Chan, DMA_TD[0]);

   

CyDmaChEnable(DMA_Chan, 1);// Enable DMA channel

   

 

   

P.S. If you working on 7-channel audio equaliser, then using Goertzel algorithm might be more efficient than FFT.

   

http://www.embedded.com/design/configurable-systems/4024443/The-Goertzel-Algorithm

   

see other thread also:

   

http://www.cypress.com/forum/psoc-5-device-programming/implenting-goertzel-algorithm-psoc-5lp

View solution in original post

0 Likes
5 Replies
JoMe_264151
Expert II

I cannot see where you started the DMA.

   

It is always easier to check a program when you post your complete project or a shortened version that shows the error so that we all can have a look at all of your settings. To do so, use
Creator->File->Create Workspace Bundle (minimal)
and attach the resulting file.

   

 

   

Bob

0 Likes
Anonymous
Not applicable

Hi

   

I don't know how to DMA start. Because I know that DMA_1_DmaInitialize function is doing the same thing.

   

I am trying to get an FFT. ADC and DMA must be sampled together and placed in a array. But I could not run ADC and DMA.

   

I added the project in the attachment. Please Check it. 

   

Thanks

0 Likes
rola_264706
Honored Contributor II

Did you check this document for information? http://www.cypress.com/file/134681/download

0 Likes
Anonymous
Not applicable

Yes I checked that file. As if there were no mistakes

   

Now, I'm trying examples on CY8CKIT-50 and CY8C5868 Device. I could not run any of the applications in AN61102.

   

http://www.cypress.com/documentation/application-notes/an61102-psocr-3-and-psoc-5lp-adc-data-bufferi...

   

I need help 😕

0 Likes
odissey1
Honored Contributor II

Mucit123, are you missing DMA enable call?

   

CyDmaChSetInitialTd(DMA_Chan, DMA_TD[0]);

   

CyDmaChEnable(DMA_Chan, 1);// Enable DMA channel

   

 

   

P.S. If you working on 7-channel audio equaliser, then using Goertzel algorithm might be more efficient than FFT.

   

http://www.embedded.com/design/configurable-systems/4024443/The-Goertzel-Algorithm

   

see other thread also:

   

http://www.cypress.com/forum/psoc-5-device-programming/implenting-goertzel-algorithm-psoc-5lp

View solution in original post

0 Likes