Tool/software: Code Composer Studio
Hi, Some question comes when I use the SPI interface, when debug in lookback mode, the data is send, but it stops in " while(SpiaRegs.SPIFFRX.bit.RXFFST !=1) ;"always, I do not know the reason. my code is as follows:
void InitSpi(void)
{
EALLOW;
GpioMuxRegs.GPFMUX.all = 0x000f;
EDIS;
// Initialize SPI-A:
SpiaRegs.SPICCR.bit.SPISWRESET=0; // Reset SPI
SpiaRegs.SPICCR.all =0x0017; // Reset on, rising edge, 8-bit char bits
SpiaRegs.SPICTL.all =0x0006; // Enable master mode, normal phase,
SpiaRegs.SPISTS.all=0x0000;
SpiaRegs.SPIBRR =0x007F; // LSPCLK/(SPIBRR+1)
SpiaRegs.SPICCR.all =0x0087; // Relinquish SPI from Reset
}
Uint16 SpiReadWrite(Uint16 wdata)
{
Uint16 rdata;
SpiaRegs.SPITXBUF=wdata;
while(SpiaRegs.SPIFFRX.bit.RXFFST !=1) ;
rdata = SpiaRegs.SPIRXBUF;
return rdata;
}