AnsweredAssumed Answered

K60 as SPI slave, questions regarding SS, PUSHR_SLAVE, ISR

Question asked by Frank Zhao on Nov 17, 2011
Latest reply on May 29, 2013 by Hanson He

I need to write code to make the K60 as a SPI slave device, and it must behave a certain way. I have a few questions

 

Is it possible to assign a rising or falling edge interrupt to the slave select pin if its alternate function is configured to be the slave select pin? I need to know if I can use an event handler before the first byte is transfered. I need to know how to process incoming data in my transmit complete interrupt according to whether or not it was the first byte of the entire transaction.

 

SPIx_PUSHR_SLAVE is 32 bits, if I set my frame size to 8 bits, and I put in 0xA1B2C3D4 into SPIx_PUSHR_SLAVE , and 8 bits are shifted out, then I write 0x12345678 into SPIx_PUSHR_SLAVE, then the master shifts another 8 bits, then the master has received 0xD4 and then 0x78, correct?

 

What if I set my frame size to 8 bits, and I put in 0xA1B2C3D4 into SPIx_PUSHR_SLAVE once, and 8 bits are shifted out twice by the master, would the master has received 0xD4 and them 0xD4? Or would it receive 0xD4 and then 0xC3?

 

Is there a timing diagram that will show me the latency between the bits being transfered and the occurance of the transmit complete interrupt?

 

Does anybody have a SPI slave example implementation or driver/library/module that they can share?

 

Outcomes