Todd Gyure

SPI, Unable to Clear SPRF in Simulator

Discussion created by Todd Gyure on Jul 12, 2007
Latest reply on Jul 15, 2007 by David Payne
Using the 68HC908JW32 with CodeWarrior full chip simulation debugger, after successfully sending data out with the SPI module, I am unable to clear the bit for the receiver full SPRF in the SPSCR register.  I read the Status and Control Register and the Data Register as directed by the data sheet, but the bit won't go away.
 
Code:
  while (SPSCR_SPTE==0);  //Wait for SPI transmit data register to empty  SPDR = DataOut;         //Send data to be written  while (SPSCR_SPRF==0);  //Wait for SPI receive data  SPSCR;                  //Clear SPRF per data sheet  SPDR;                   // by reading SPSCR and SPDR

 
I have also tried multiple reads of the SPSCR and SPDR and looping while waiting for the bit to clear.
Please pardon my C; I was raised on assembly language.
 
Any assistance would be greatly appreciated!

Outcomes