AnsweredAssumed Answered

SPI Communication with S12x (Slave), any hardware flags showing that transmission  has finished?

Question asked by Thomas Naiser on Aug 9, 2012
Latest reply on Aug 13, 2012 by Thomas Naiser

Hello,
I am working on an SPI communication between an S12X (as slave) and an embedded PC as master.

The master sends a 3-byte command to the slave and first  receives the number of data bytes to read. Then the master sends the corresponding number of dummy bytes on MOSI /receives the data bytes on MISO.
Between two consecutive datablocks (sized limited to 1000 bytes) I need  to reset counters, buffers etc. Thats why  I need  to  know when all data bytes were sent.  

So far I used the number of the sent bytes returned by the SPI - Sendblock-routine (automatically generated by  codewarrior 5.9 /ProcessorExpert), but this doesn't really  tell when send-block has finished the data transfer.
When  I set the data receive counter (RxCharCounter) to zero,  often the transmission hasn't finished by then. Then  the receive counter, starting from zero counts the bytes from the unfinished transmission.
This causes errors in the interpretation of the following command bytes.
 
My questions is:

  • How do I know for certain, that the SPI data transfer  (from the microcontroller to the embedded PC - via Sendblock ) has  finished? In principle I could wait for long enough, but since the master is not a realtime system there is a big variability in the duration of the transmission, this is not a really good option.
  • Important: I need to know when the hardware has finished the data transfer (and not when all data has been copied to the transmit-buffer).
  • Is there a hardware flag showing that the transmission is complete?


Best regards

Tom

Outcomes