I have a similar question to ask you about SPI.
I use f2802x in project,and it works in non-FIFO mode.When I write some bytes to SpiaRegs.SPIDAT(like SpiaRegs.SPIDAT=a),I find that it is always a wrong value(not equal to a,it changes,most of time is 0xFFFF).If it works in loop back mode,the value of SpiaRegs.SPIDAT is right.
void spi_init()
{
SpiaRegs.SPICCR.all =0x000F; // Reset on, rising edge, 16-bit char bits
SpiaRegs.SPICTL.all =0x0006; // Enable master mode, normal phase
// enable talk, and SPI int disabled.
SpiaRegs.SPIBRR =0x007F;
SpiaRegs.SPICCR.all =0x008F; // Relinquish SPI from Reset
SpiaRegs.SPIPRI.bit.FREE = 1; // Set so breakpoints don't disturb xmission
}
void spi_xmit(Uint16 a)
{
SpiaRegs.SPIDAT=a;
//SpiaRegs.SPICCR.all =0x009F;
delay_loop();
}
void spi_fifo_init()
{
// Initialize SPI FIFO registers
SpiaRegs.SPIFFTX.all=0xA040; //E040
SpiaRegs.SPIFFRX.all=0x2044;
SpiaRegs.SPIFFCT.all=0x0;
}
Thanks for your reply,I really need your help!