AnsweredAssumed Answered

SPI shift register value on Kinetis

Question asked by Jörg Volger on Nov 28, 2014
Latest reply on Jan 15, 2015 by Jörg Volger

Hi all,

I have a problem with the Kinetis SPI module

MCU: K10DX32

software: CodeWarrior Development Studio 10.6

programmer: PE micro multilink universal

 

The SPI module is configurated as slave. When data is coming in at SIN an interrupt is generated where the data are saved in a buffer. This is working.

From other MCUs and applications I'm used that the incoming data are automatically shifted out to SOUT when the next data is coming. But here the value at SOUT is always zero.

Then I tried to set the value of the shift register manually by writing the desired value into SPI0_PUSHR_SLAVE. This results in the following behaviour:

- data received, SPI0_PUSHR_SLAVE set with value1,        0 is shifted out  => ok

- data received, SPI0_PUSHR_SLAVE set with value2, value1 is shifted out  => ok

- data received, SPI0_PUSHR_SLAVE set with value3, value1 is shifted out  => not ok

- now always value1 is shiftet out

It seems that writing to SPI0_PUSHR_SLAVE works exactly one time. Enabling or disabling the FIFO shows the same behaviour.

I analysed a lot of flags and registers to understand what happens, but without success.

 

my configuration:

 

interrupt code:

/*

** ===================================================================

**     Interrupt handler : SPI

**

**     Description :

**         User interrupt service routine.

**     Parameters  : None

**     Returns     : Nothing

** ===================================================================

*/

PE_ISR(SPI)

{

  /* Write your interrupt code here ... */

   

    // save the input data

    spidata = SPI0_POPR;

    // set the FIFO register with some value that should appear at the output next time

    SPI0_PUSHR_SLAVE = value;

    // clear the Receive FIFO Drain Flag

    SPI0_SR |= SPI_SR_RFDF_MASK;

}

 

regards,

Jörg

Outcomes