AnsweredAssumed Answered

daq2 send costum data to Dac failed

Question asked by scbigfatcat on Aug 28, 2016
Latest reply on Nov 1, 2016 by scbigfatcat

I use zc706board and want to send my custom data to dac but it failed. I don't get the waveform I want. My code is as follows. I use the example  ad9361/dac_core,Someone please help!!!!!!!!!

 

for(index = 0, index_mem = 0; index < (tx_count * 2); index += 2, index_mem += 4){
index_i1 = index;
index_q1 = index + (tx_count / 2);
if(index_q1 >= (tx_count * 2))
index_q1 -= (tx_count * 2);
data_i1 = (sine_lut[index_i1 / 2] << 20);
data_q1 = (sine_lut[index_q1 / 2] << 4);
Xil_Out32(DAC_DDR_BASEADDR + (index_mem + 2) * 4, data_i1 | data_q1);

index_i2 = index_i1;
index_q2 = index_q1;
if(index_i2 >= (tx_count * 2))
index_i2 -= (tx_count * 2);
if(index_q2 >= (tx_count * 2))
index_q2 -= (tx_count * 2);
data_i2 = (sine_lut[index_i2 / 2] << 20);
data_q2 = (sine_lut[index_q2 / 2] << 4);
Xil_Out32(DAC_DDR_BASEADDR + (index_mem + 1) * 4, data_i2 | data_q2);
}

length = (tx_count * 16);

 

dac_dma_write(AXI_DMAC_REG_CTRL, 0);
dac_dma_write(AXI_DMAC_REG_CTRL, AXI_DMAC_CTRL_ENABLE);

dac_dma_read(AXI_DMAC_REG_TRANSFER_ID, &transfer_id);
dac_dma_read(AXI_DMAC_REG_IRQ_PENDING, &reg_val);
dac_dma_write(AXI_DMAC_REG_IRQ_PENDING, reg_val);


dac_dma_write(AXI_DMAC_REG_SRC_ADDRESS, DAC_DDR_BASEADDR);
dac_dma_write(AXI_DMAC_REG_SRC_STRIDE, 0x0);
dac_dma_write(AXI_DMAC_REG_X_LENGTH, length - 1);
dac_dma_write(AXI_DMAC_REG_Y_LENGTH, 0x0);
dac_dma_write(AXI_DMAC_REG_FLAGS, 0x2);
dac_dma_write(AXI_DMAC_REG_START_TRANSFER, 0x1);

 

dac_write(DAC_REG_CHAN_CNTRL_7(0), DATA_SEL_DMA); 
dac_write(DAC_REG_CHAN_CNTRL_7(1), DATA_SEL_DMA);
dac_write(DAC_REG_CHAN_CNTRL_7(2), DATA_SEL_DMA);
dac_write(DAC_REG_CHAN_CNTRL_7(3), DATA_SEL_DMA);

Outcomes