Hello,
I'm using the SPI module of the F28335 to interface with a WIZ820io W5200 ethernet device. I can set up the WizNet just fine, but my problem arises when I want to read/write packets. I am unable to read incoming packets consistently and I am wondering if the issue has to do with how I am pulling the data from the SPI RXBuffer.
I have it set up for an 8 bit word length. Shown below is my SPI init function and my SPI read/write function.
void spi_fifo_init(){ //Initialize SPI FIFO registers SpiaRegs.SPIFFTX.all = 0xE040; //Transmit registers SpiaRegs.SPIFFRX.all = 0x204f; //Read registers SpiaRegs.SPIFFCT.all = 0x00; // Transmit delay = no delay SpiaRegs.SPICCR.all =0x0047; // 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 =0x004A; // Baud rate = LSPCLK/(4) SpiaRegs.SPIBRR =0x00f0; SpiaRegs.SPICCR.all =0x00c7; // Relinquish SPI from Reset, 8 bit SpiaRegs.SPIPRI.bit.FREE = 1; // Set so breakpoints don't disturb xmission } Uint8 spi_Write(Uint8 msg){ // loads buffer and sends it out Uint16 Tdata = (0xFF00)&(msg<<8); SpiaRegs.SPITXBUF = Tdata; while(SpiaRegs.SPIFFRX.bit.RXFFST!=1) { } Uint8 rdata = (0xFF & (SpiaRegs.SPIRXBUF)); return rdata; }