Hello,
I'm facing a problem with the SPI used in slave mode with the RxFifo.
In my application, I can have a prior interrupt (to control a motor) .
Then for the SPI interrupt which is configured when the SPI slave receive data, it can be delayed when the Main prior interrupt finish.
So I can receive many SPI data before the interrupt really occurs.
Then I use the Rx Fifo. The RXFILL is set to 1.
But I observe some behavior:
- On the first data received, SPI_O_Dat register is set with RXFFST set to 1. Then I must read the DAT register in this case, not the RXBUFF which return dummy value.
But I must read the RXBUFF to decrease the RXFFST to 0 to not generate another interrupt.
Why the SPI_O_Dat register not fill directly the RXBUF? This is a problem because I must test the RXFFST,
If = 1 => Read DAT and RXBUFF to empty the RXFFST
if > 1 : Read only the RXBUFF to get first received data.
But if new char is received between the test of RSFFST and the read of the register (RXBUF / DAT) this cause problem!
What is the good way to use correctly the SPI Slave with the RXBuf fifo?
I can't find a good solution!
Thank