cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC™ 5, 3 & 1

greg79
New Contributor II

I am trying to get samples from two LUTs with chained TDs. The clock signal starts TD0 (from LUT array to register, increase source address) which then starts TD1. Once TD1 is executed, an interrupt is generated to process the samples stored in the registers. For some reason the LED lights up but does not turn off and needless to say, there is no signal on the scope. What am I doing wrong? It has to be something to do with the TD configuration. Thank you for any help in advance.

td_chain.PNG

#define DMA_1_BYTES_PER_BURST 1
#define DMA_1_REQUEST_PER_BURST 1
#define DMA_1_SRC_BASE (CYDEV_SRAM_BASE)
#define DMA_1_DST_BASE (CYDEV_SRAM_BASE)

#include "project.h"
#include "LUT.h"

void configureDMA(void);
CY_ISR_PROTO(isr_1);

uint8_t sineReg;
uint8_t sawReg;

int main(void)
{
    CyGlobalIntEnable; /* Enable global interrupts. */
    configureDMA();
    VDAC8_1_Start();
    VDAC8_2_Start();
    isr_1_StartEx(isr_1);
    LED_pin_Write(0u);
    for(;;)
    {
    }
}
CY_ISR(isr_1){
    // do math on sample then write sit in DAC register 
    LED_pin_Write(1u);
    VDAC8_1_SetValue(sineReg);
    VDAC8_2_SetValue(sawReg);
    CyDelay(100);
    LED_pin_Write(0u);
}

void configureDMA(){

uint8 DMA_1_Chan;
uint8 DMA_1_TD[2];

/* DMA Configuration for DMA_1 */
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));
DMA_1_TD[0] = CyDmaTdAllocate();
DMA_1_TD[1] = CyDmaTdAllocate();
CyDmaTdSetConfiguration(DMA_1_TD[0], 1, DMA_1_TD[1], CY_DMA_TD_INC_SRC_ADR | CY_DMA_TD_AUTO_EXEC_NEXT);
CyDmaTdSetConfiguration(DMA_1_TD[1], 1, DMA_1_TD[0], DMA_1__TD_TERMOUT_EN | CY_DMA_TD_INC_SRC_ADR);
CyDmaTdSetAddress(DMA_1_TD[0], LO16((uint32)sineWaveLUT), LO16((uint32)sineReg));
CyDmaTdSetAddress(DMA_1_TD[1], LO16((uint32)sawWaveLUT), LO16((uint32)sawReg));
CyDmaChSetInitialTd(DMA_1_Chan, DMA_1_TD[0]);
CyDmaChEnable(DMA_1_Chan, 1);
}

 

 

0 Likes
2 Replies