I am new in development with Kinetis microcontroller (MK66FN2M0VMD18) and I am trying to create an application which read not specified number of bytes (SPI frame) from SPI Master using an interrupt. I was able to implement basic functionality because I went through the downloaded examples.
while(DSPI_GetStatusFlags(SPI0) & kDSPI_RxFifoDrainRequestFlag)
slaveRxData[counter++] = DSPI_ReadData(SPI0);
Slave receives valid SPI frame and stores it to the slaveRxData buffer. Comparing to the examples, interrupt is disabled and receive process is completed when number of received bytes is equal to an expected value, but there is no expected number of bytes in my application.
When should I disable interrupt and how can I detect when SPI does not receive any SPI frame ? I would expect that SPI status register SPI0_SR has busy flag.
Thanks a lot !