Hi,
I am using the F28335 SPI to emulate an EEPROM. It works as an slave with words of 8 bits. I have enabled the FIFOs.
My application starts with the RXINT enabled and TXINT disabled, the level of the FIFO for the RXINT is 1 and for the TXINT is zero.
In the picture below the following lines are
D0: #SPISTE
D3: SPICLK (there is a discontinuity every 8 cycles of the SPICLK)
D4: MOSI
D5: SOMI
D14: goes high when SpiRxInt Isr enters and down before leaving the Isr.
D15: toggles every time a byte is copies to the SPITXBUF
1.- The first byte I receive triggers RXINT (fist pulse in D14 from picture below); in the context of the interrupt I parse the command
2.- The second byte I receive triggers the second RXINT (second pulse in D14); in the context of this interrupt:
- I parse the addres
- Copy some bytes into the SPITXBUF (this happens when line D15 toggles)
- disable in RXINT
- enable the TXINT
In my application I know the number of bytes that are going to be read from each address, so I will be waiting from the TXFIFO to be empty in order to copy more bytes into the FIFO
3.- When the TXFIFO gets empty if I have more data to transmit I copy more data into SPITXBUF.
4.- When the TXFIFO gets empty and I have no more data to transmit
- I clear the FIFOs
- Disable the TX INT
- Enable the RX INT.
This is the code that disables the TXINT enables RXINT and clears the flags. I know I am overdoing it, but still I get an extra RXINT when SPISTE - D0 goes high
SpiaRegs.SPICCR.bit.SPISWRESET = 0;
SpiaRegs.SPIFFTX.bit.SPIRST = 0; // Reset the TX & RX Buffers
SpiaRegs.SPIFFTX.bit.SPIRST = 1;
// clear receive FIFO
SpiaRegs.SPIFFRX.bit.RXFIFORESET = 0;
SpiaRegs.SPIFFRX.bit.RXFIFORESET = 1;
// Clear the over-run flag.
SpiaRegs.SPISTS.bit.OVERRUN_FLAG = 1;
SpiaRegs.SPIFFRX.bit.RXFFOVFCLR = 1; // Clear Overflow flag
SpiaRegs.SPIFFRX.bit.RXFFINTCLR = 1; // Clear Interrupt flag
SpiaRegs.SPIFFRX.bit.RXFFIENA = 1; // Enable Rx Interrupt
SpiaRegs.SPIFFTX.bit.TXFIFO = 1; // Enable the FIFO
SpiaRegs.SPICCR.bit.SPISWRESET = 1;
My question is if this is the expected behaviour of RXINT, and I should check that the SPISTE line is not high within the SpiRxIsr.
