vengeful

SPI Slave MC9S12G

Discussion created by vengeful on Mar 28, 2013
Latest reply on Apr 1, 2013 by vengeful

Hello All,

 

Seem to have run into a bit of a problem here, setting up the above micro for slave operation and when I am ready to send something, I alert the Master and then enable Transmit Interrupts. In the interrupt, I test for empty, and then load up the SPI0DRL register, the Interrupt is then disabled when the data is transmitted out. However, while in debug mode, I see that the SPI0DRL register does not get populated and hence on the Master side I see 00's coming through. The physical connections seem to work, as I watched them on a scope, SS is low, and I get clocked, but this SPI buffer just never gets populated.

 

Setup:

 

SPI0BR = 0x01;  

//Baud Rate Divisor = 4 -> SPI speed of 4Mbps  ( Baud = Bus Clock/ BR Divisor)

SPI0CR2 = 0;
SPI0CR1 = 0b01000000;    //Rx interrupt disabled, SPI enabled, Tx interrupt disabled, Slave mode, Default clock polarity & phase, Manual Slave Select, MSB first

 

In main :

Wait for 2 Second timer to expire, then Alert the master of data to send, Enable transmit SPI int

 

In Interrupt;

     SPI0DRL = Data;  // Somehow this does not seem to get popuplated

 

Using Codewarrior IDE, MC9S12G192 and Multilink ICD

Outcomes