AnsweredAssumed Answered

AD5446 IS NOT GIVING RESPONSE

Question asked by hariom on Apr 6, 2015
Latest reply on May 12, 2015 by danf

sir /madam ad5446 is not giving any response i am using PIC PIC32MX795F512L IC and using spi4 for driving the dac in unipolar mode with 5 mhz frequency,10 volt reference voltage and 5 volt supply and sending data in 16 bit mode to the dac ic and while observing the output lines of spi waveform pattern is as given in data sheet  but    no output is coming on the dac out put lines    

 

this is my code

 

 

 

#define SDO_LINE TRISFbits.TRISF5

#define SDI_LINE TRISFbits.TRISF4

#define SCK_LINE TRISFbits.TRISF13

#define SS_LINE TRISFbits.TRISF12

/*******************************************************************************************************************/

/* For level setting */

/*******************************************************************************************************************/

#define SDO_LEVEL LATFbits.LATF5 /* WRITE */

#define SDI_LEVEL PORTFbits.PORTF4 /* READ */

#define SCK_LEVEL LATFbits.LATF13 /* WRITE */

#define SS_LEVEL LATFbits.LATF12 /* WRITE */

#define SPI_TX_RX_BUFFER SPI4BUF

#define RX_BUFFER_STATUS SPI4STATbits.SPIRBF

#define Master_Mode_Enable SPI4CONbits.MSTEN

#define CLOCK_Polarity_Sel SPI4CONbits.CKP

#define CLOCK_Edge_Sel SPI4CONbits.CKE

#define Slave_Select_Enable SPI4CONbits.SSEN

#define Data_INPUT_Sample_Phase SPI4CONbits.SMP

#define Comm_Select_Bit1 SPI4CONbits.MODE32

#define Comm_Select_Bit2 SPI4CONbits.MODE16

#define Disable_SDO SPI4CONbits.DISSDO

#define TX_BUFF_EMPTY_INTERRUPT SPI4CONbits.STXISEL

#define STOP_IN_IDLE_MODE SPI4CONbits.SIDL

#define Enhanced_Buffer_Mode SPI4CONbits.ENHBUF

#define Frame_Support_Mode SPI4CONbits.FRMEN

#define Master_Mode_Slave_Sel SPI4CONbits.MSSEN

#define Clear_Overflow SPI4STATCLR

#define Enable_SPI SPI4CONbits.ON

#define SPI_Baud_Rate SPI4BRG

#define Reset_SPI SPI4CON

#define Disable_Interrupt IEC1CLR

#define Clear_Event IFS1CLR

#define Clear_Priority IPC8CLR

#define Set_Priority IPC8SET

#define delay for(i=0;i<20;i++) Nop()

 

 

int main()

{

DAC();

 

 

}

void DAC()

{

SPI_Init();

CE_Low();

WriteSpi((0x0001 & 0x3FFF ));

CE_High(); /* De-select the chip */

}

 

 

void SPI_Init(void)

{ unsigned int i=0;

int rData;

SDO_LINE=0; /* Set sdo line as output from master controller */

SDI_LINE=1; /* Receive the data from slave */

SCK_LINE=0; /* Provide the clock pulses from master to slave */

SS_LINE=0; /* CHIP SELECT LINE TO initiate communication */

SS_LEVEL=1; /* De-select the CHIP SELECT */

for(i=0;i<20;i++) Nop();

Disable_Interrupt=0x00000700; /* disable all interrupts */

Reset_SPI = 0; /* Stops and resets the SPI1 */

rData=SPI_TX_RX_BUFFER; /* clears the receive buffer */

Clear_Event=0x00000700; /* clear any existing event */

Clear_Priority =0x0000001F; /* clear the priority */

Set_Priority = 0x00000004; /* Set priority level=1 */

delay;

Master_Mode_Enable=1; /* master mode enable bit */

CLOCK_Polarity_Sel=0; /* 0 = Idle state for clock is a high level; active state is a low level */

CLOCK_Edge_Sel=1;

Slave_Select_Enable=0; /* SS pin used for Slave mode */

Data_INPUT_Sample_Phase=1; /* Input data sampled at middle of data output time */

Comm_Select_Bit1=0; /* 16-bit data format */

Comm_Select_Bit2=1;

Disable_SDO=0;

TX_BUFF_EMPTY_INTERRUPT=0; /* Interrupt generation when data is xmitted */

STOP_IN_IDLE_MODE=0; /* Continue operation in Idle mode */

Enhanced_Buffer_Mode=0; /* Enhanced Buffer mode is disabled */

Frame_Support_Mode=0; /* Framed SPI support is disabled */

Master_Mode_Slave_Sel=0; /* Slave select SPI support enabled. The SS pin is automatically driven during transmission in*/

Clear_Overflow=0x40; /* clear the Overflow */

SPI_Baud_Rate=0;

Enable_SPI=1;

delay;

}

Outcomes