I am using a TMS320F28335eZdsp to communicate with DAC8560 EVM.
The connection are:
GPIO18_SPICLKA---->DAC8560EVM's J2-3 SCLK
GPIO19_SPISTAn----->DAC8560EVM's J2-7 SYNC
GPIO16_SPISIMOA---->DAC8560EVM's J2-11 DIN
The sequence of sclk, sync, din are fine and the internal reference is 2.5v.
But there is no output signal. I only can see some noise changing with the sclk frequency.
Here is the code.
void InitSpiaGpio()
{
EALLOW;
GpioCtrlRegs.GPAPUD.bit.GPIO16 = 0; // Enable pull-up on GPIO16 (SPISIMOA)
GpioCtrlRegs.GPAPUD.bit.GPIO18 = 0; // Enable pull-up on GPIO18 (SPICLKA)
GpioCtrlRegs.GPAPUD.bit.GPIO19 = 0; // Enable pull-up on GPIO19 (SPISTEA)
GpioCtrlRegs.GPAQSEL2.bit.GPIO16 = 3; // Asynch input GPIO16 (SPISIMOA)
GpioCtrlRegs.GPAQSEL2.bit.GPIO18 = 3; // Asynch input GPIO18 (SPICLKA)
GpioCtrlRegs.GPAQSEL2.bit.GPIO19 = 3; // Asynch input GPIO19 (SPISTEA)
GpioCtrlRegs.GPAMUX2.bit.GPIO16 = 1; // Configure GPIO16 as SPISIMOA
GpioCtrlRegs.GPAMUX2.bit.GPIO18 = 1; // Configure GPIO18 as SPICLKA
GpioCtrlRegs.GPAMUX2.bit.GPIO19 = 0; // Configure GPIO19 as GPIO
GpioCtrlRegs.GPADIR.bit.GPIO19 = 1; // Configure GPIO19 as Output
EDIS;
}
void DAC_Spi_Initialization()
{
SpiaRegs.SPICCR.all =0x0047; // Reset on, rising edge, 16-bit char bits
SpiaRegs.SPICTL.all =0x000E; // Enable master mode, shift phase,
// enable talk, and SPI int disabled.
EALLOW;
SysCtrlRegs.LOSPCP.bit.LSPCLK = 3; // SYSCLKOUT / 6 = 25 MHz
EDIS;
SpiaRegs.SPIBRR = 29; // SPICLK = LSPCLK / (1 + 99) = 500 kHz
SpiaRegs.SPICCR.all =0x00c7; // Relinquish SPI from Reset
SpiaRegs.SPIPRI.bit.FREE = 1; // Set so breakpoints don't disturb xmission
EDIS;
}
Uint16 spi_xmit_byte(Uint16 byte)
{
SpiaRegs.SPITXBUF = byte; //Transmit Byte
while(SpiaRegs.SPISTS.bit.INT_FLAG != 1); //Wait until the RXBUF has received last bit
return (SpiaRegs.SPIRXBUF << 8); //Read Byte from RXBUF and return
}
void WriteDAC(unsigned int cmd,unsigned int date)
{
GpioDataRegs.GPADAT.bit.GPIO19 = 0;
delay(10);
value1=(cmd<<8);
value2=(date>>8)<<8;
value3=date<<8;
spi_xmit_byte(value1);
delay(10);
spi_xmit_byte(value2);
delay(10);
spi_xmit_byte(value3);
delay(10);
GpioDataRegs.GPADAT.bit.GPIO19 = 1;
}
void main(void)
{
InitSysCtrl();
DINT;
IER = 0x0000;
IFR = 0x0000;
InitPieCtrl();
InitPieVectTable();
///³õʼ»¯IO¿Ú
InitSpiaGpio();
///³õʼ»¯SPI
DAC_Spi_Initialization();
value1=0;
value2=0;
value3=0;
EINT; // Enable Global interrupt INTM
ERTM; // Enable Global realtime interrupt DBGM
while(1)
{
WriteDAC(0,0xFF00 );
delay(500);
}
}
CH2 is the SCLK
CH3 is the SYNC
CH4 is the DIN