[MC68HC908QB4] Continuing SPI Woes

Discussion created by Guest on Aug 2, 2006
Latest reply on Aug 28, 2006 by Guest
I cotinue having difficulties implementing my SPI app on the -908QB4.  The data sheet (attached) mentions "double-buffering" transmit data for the SPI (in sec. 15.3.4 if anybody's interested).  This would be really cool if I could get it to work, as I have to complete at total of two 16-bit read cycles in under 333 us.
 
What I observed was this:
 
I tried to use the nifty-keen double-buffering transmit by writing my first byte to the SPDR, then sitting in a loop waiting for the SPTE (transmit empty) flag to be set, then shoving my second byte into the SPDR.  Then I have the receive-full interrupt set up to begin my second read-cycle.
 
When stepping through the code, after I put the first byte into the SPDR, the SPRF flags sets immediatly, but no matter what the next line of code is, the SPRF clears without my Rx interrupt being serviced.
 
I pondered this for awhile before hitting on an idea - I don't really care with that first byte of data clocked in from my slave device is, because it's garbage to me, I just care what the second byte of Rx'd data is.  I restructured my Rx interrupt around this theory, and it works great, exept that the overflow (OVRF) flag is set, indicating a Rx overflow, and my second byte of data is lost - even though the Rx interrupt was never serviced to take care of the first byte!
 
Help me Freescale Forums, you're my only hope!
 
Message Edited by t.dowe on 2009-09-22 11:56 AM

Outcomes