Deepika A

SPI - 08GB60

Discussion created by Deepika A on Jan 7, 2008
Latest reply on Jan 11, 2008 by Ake Webjorn
Hello,
 
I have done one simple program in SPI .
From master sending one char contniously ,If reciver flag is set then after clearing the flag send the recived value to SCI. In slave , only clearing  the SPI reciver flag. Since In SPI when master start transmitting it will also start receving what ever data in the slave shift register at that time. So  from the second data of transfer from master. Master is expected to receive whatever data that send to slave previously.
 
Master Code:
while(1)
{
SPDR = name;
  while(!SPSCR_SPRF);  
    rec_data = SPDR;
   sendSCIchar(rec_data);
}
Slave code:
while(1)
 {
  
  while(!SPSCR_SPRF);  
       rec_data = SPDR;
}
 
When name =  'A'  Not getting A all the times.
When name =  'B'  Getting B contniouly.
When sending  two data in the while loop that is when sending A and B from master.
Getting AB contniously.
when name = 'C' Getting different characters in the middle.
when name = 'D' Getting D contniously.
 
when SPDR = 0xAA getting contniously.
when SPDR = 0xAB getting different character in the middle.
 
My assumption is when the characters equivalent binary ends with (LSB) 1 I am getting this problem.
I didnt understand why it is behaving differently Whether  problem with my Code. Or problem with my circuits.Or whether my understaning of SPI is not correct.
 
Kindly Help to solve this problem.


Message Edited by NLFSJ on 2008-01-14 04:07 PM

Outcomes