Other Parts Discussed in Thread: TMS320F2812
Hi,
I'm having some trouble trying to transmit from the SPI peripheral with my TMS320F2812. In my configuration, the DSP is the master and the DAC is the slave. The DAC is an LT2622 (12-bit), but my problems starts even before trying to successfully send commands to the DAC. I'm not seeing the correct signals coming from the SPI lines themselves.
Here's how I'm configuring the peripheral:
void SetupSpi(void)
{
EALLOW; //Setup peripheral clock for SPI
SysCtrlRegs.LOSPCP.all = 0x0002;
SysCtrlRegs.PCLKCR.bit.SPIENCLK=1;
EDIS;
//SPI Configuration Control Register:
SpiaRegs.SPICCR.bit.SPISWRESET = 0; //initialize operating flags
SpiaRegs.SPICCR.bit.CLKPOLARITY = 0; //Data output on rising edge
SpiaRegs.SPICCR.bit.SPILBK = 0; //disable loopback for now, testing...
SpiaRegs.SPICCR.bit.SPICHAR = 0xF; //setup for 16 bit words
//SPI Operation Control Register
SpiaRegs.SPICTL.bit.OVERRUNINTENA = 0; //Disable overrun interrupt
SpiaRegs.SPICTL.bit.CLK_PHASE = 1; //Data is output one half-cycle before the first rising edge of the SPICLK signal and on subsequent falling edges of the SPICLK signal; input data is latched on the rising edge of the SPICLK signal
SpiaRegs.SPICTL.bit.MASTER_SLAVE = 1; //Configure SPI as master
SpiaRegs.SPICTL.bit.TALK = 1; //transmit enable pin enabled
SpiaRegs.SPICTL.bit.SPIINTENA = 0; //Disable SPI interrupt
//SPI Baud Rate Register
//SPI Boud Rate = (LSPCLK)/(SPIBRR+1), for SPIBRR =3:127
SpiaRegs.SPIBRR = 63; //~1.3MHz for now
//SpiaRegs.SPIFFCT = //SPI FIFO Control Register
//SpiaRegs.SPIPRI = //SPI Priority Control Register
}
Here's my test loop, in which I'm trying to get the DAC to switch between two values:
// IDLE loop. Just sit and loop forever:
for(;;){
SpiaRegs.SPITXBUF = 0x3F; //command
SpiaRegs.SPITXBUF = 0x3E80; //data 1000
delay_loop();
SpiaRegs.SPITXBUF = 0x3F; //command
SpiaRegs.SPITXBUF = 0xBB80; //data 3000
delay_loop();
};
What I'm seeing is the SPICLKA and SPITEA lines are staying low and the SPISIMOA line is just toggling at the period of the delay in the loop. I'm not seeing any data being sent from the peripheral.
What am I missing here? Any help is appreciated. Thanks!
Jason