UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Participant jacob.varghese
Participant
3,217 Views
Registered: ‎05-28-2015

DAC SPI Interface with PowerPc in virtex 5

Hello,

I am trying to write to AD9707 SPI register.I have written my own code for the same but It is not working, the register values are not getting updated. Here is my code, Can anybody please tell me where I am going wrong? 
/*

 *Register offsets for the XSpi device.
 */
#define XSP_DGIER_OFFSET    0x1C    /**< Global Intr Enable Reg */
#define XSP_IISR_OFFSET        0x20    /**< Interrupt status Reg */
#define XSP_IIER_OFFSET        0x28    /**< Interrupt Enable Reg */
#define XSP_SRR_OFFSET         0x40    /**< Software Reset register */
#define XSP_CR_OFFSET        0x60    /**< Control register */
#define XSP_SR_OFFSET        0x64    /**< Status Register */
#define XSP_DTR_OFFSET        0x68    /**< Data transmit */
#define XSP_DRR_OFFSET        0x6C    /**< Data receive */
#define XSP_SSR_OFFSET        0x70    /**< 32-bit slave select */
#define XSP_TFO_OFFSET        0x74    /**< Tx FIFO occupancy */
#define XSP_RFO_OFFSET        0x78    /**< Rx FIFO occupancy */

 

 

/*
 * SPI Software Reset Register (SRR) mask.
 */
#define XSP_SRR_RESET_MASK        0x0000000A

int main()

{

u32 ControlReg;

u16 data;

        XSpi_WriteReg(DAC_SPI_BASEADDRESS, XSP_SRR_OFFSET,XSP_SRR_RESET_MASK);

        ControlReg |= XSP_CR_TXFIFO_RESET_MASK | XSP_CR_RXFIFO_RESET_MASK |
                XSP_CR_ENABLE_MASK | XSP_CR_MASTER_MODE_MASK ;

         XSpi_WriteReg(DAC_SPI_BASEADDRESS, XSP_CR_OFFSET,ControlReg)

 

        XSpi_WriteReg(DAC_SPI_BASEADDRESS, XSP_SSR_OFFSET,0);  // slave select line

        XSpi_WriteReg(DAC_SPI_BASEADDRESS, XSP_DTR_OFFSET, 0x0080); // write to SPI control registers

        XSpi_WriteReg(DAC_SPI_BASEADDRESS, XSP_SSR_OFFSET,1);

 

        XSpi_WriteReg(DAC_SPI_BASEADDRESS, XSP_SSR_OFFSET,0);  // slave select line 
        XSpi_WriteReg(DAC_SPI_BASEADDRESS, XSP_DTR_OFFSET,0x0200); // write to data register

        XSpi_WriteReg(DAC_SPI_BASEADDRESS, XSP_SSR_OFFSET,1);

 

 

        XSpi_WriteReg(DAC_SPI_BASEADDRESS, XSP_SSR_OFFSET,0);
        XSpi_WriteReg(DAC_SPI_BASEADDRESS, XSP_DTR_OFFSET, 0x0D00);// version register

        XSpi_WriteReg(DAC_SPI_BASEADDRESS, XSP_SSR_OFFSET,1);

 

return 0;

}

 

In control register, Master transcation inhibit bit,should be set?I didnot understand the purpose of this bit...

 

0 Kudos