Hello David, Thanks for reply.
Now my SPI Master-Slave works in 9S08AC60.
I was trying Master-Master(fault mode). But i think that arrangement is imposible. When I debug it the Master with fault mode always stays in slave mode.
But my code in master-slave works now, thanks alot.
According to my fault mode code is the next.
void SPI_Init_Mstr_F(void)
{
PTEDD_PTEDD4=1; //Initializate pin (SS) like GPIO as input
PTED_PTED4=1; //No activity on SPI
SPI1C1=0xD0; /*Set SPI in master mode, active in High, first edge on clock source,
start data on least significant bit,enables the interrupts generated
by the SPRF,MODF and SS input for mode fault*/
SPI1C2=0x10; //Fault mode enable, "NO" Bidirectional
SPI1BR=0x65; /*Baud rate to 8928.57 Baud rate formule:
Baud rate = Busclock/((Prescale Divisor)(Rate Divisor))*/
}
interrupt VectorNumber_Vspi1 void Vspi1_isr_MODF(void) // This Responds to “faul mode error” interrupt
{
while (!SPI1S_MODF){}; //wait for faul mode error
// Write your code here before writing to SPI1C1 register
while (!SPI1S_SPRF){}; //Wait until the next byte is received
PTFD = SPI1D; //Save the data of the buffer
PTED_PTED4=1;
temp=SPI1S_MODF;
SPI1C1=0xD0; //Set SPI in master mode, active in High, first edge on clock source,
//start data on least significant bit,enables the interrupts generated
//by the SPRF,MODF and SS input for mode fault
SPI1C2=0x10; //Fault mode enable, "NO" Bidirectional
}
I was looking for mode fault examples. In the document that you mentioned dont have example of fault mode