I started with K64 DSPI example, any one ( blocking ,interrupt) which is working for start.
This example does not fit to my requirement where the master should only send data and the slave should answer according to that data.
So i modified the example and the fsl_dspi.c to meet my requirements.
the problem i am facing is that when the master send data to the slave
it is received correct in the interrupt of the slave( Note - After disable the fifo for both RX and TX and for master and slave because the fifo of SPI 0 is 4 and the fifo for SPI1 is 1)
But when the slave send data back to the master in the same clock , the first two bytes are 0 and i need to push additional two bytes at the end to get the entire data.
If master send 1,2,3,4 the slave gets 1,2,3,4
the slave then echo it back 1,2,3.4 the master received 0 0 , 1 2,
and for the 3,4 i need to send two additional bytes from the master (dummy 0, so total 6 bytes) to get my 1,2,3,4 back
at the master.
*Again , i disabled the fifo for SPI0 and 1 because they are not equal .
if i am not disabling the fifo , the slave does not get all the data and it need to be pushed also from the master
Can you please help me find how to force the slave output the data from the interrupt:
i reduce the code size at the slave interrupt - so here it is:
while (DSPI_GetStatusFlags(base) & kDSPI_RxFifoDrainRequestFlag)
dataReceived = base->POPR;
base->PUSHR_SLAVE = dataReceived