AnsweredAssumed Answered

MC9S12DG256 SPI with multiple slaves

Question asked by Rui Ji on Sep 18, 2014
Latest reply on Oct 5, 2014 by Rui Ji

MC9S12DG256 SPI with two slave devices: DAC TLC5618 and ADC AD7888.

They are both connected to SPI0, but they require different SPI configurations (for TLC5618 CPHA=0, for AD7888 CPHA=1).

I found in the MC9S12DG256 datasheet that "In master mode, a change of CPHA will abort a transmission in progress and force the SPI system into idle state".

How should I implement SPI communication with these two devices in my application, or should I use different SPI ports (e.g SPI0 for DAC and SPI1 for ADC)?

 

A related question:

I developed a small application to test SPI with TLC5618:

 

main()

{

  EnableInterrupt;

  SET_PLL();

  SPI_init();

  for(;;)

  {

    SPI_send();

  }

}

 

It works correctly. If I put SPI_init() into the loop:

 

main()

{

  EnableInterrupt;

  SET_PLL();

  for(;;)

  {

    SPI_init();

    SPI_send();

  }

}

 

It does't work.

Outcomes