juan bautista

Help with SPI - MC9S08GT32

Discussion created by juan bautista on Sep 28, 2008
Latest reply on Sep 28, 2008 by juan bautista

Hi everyone,
Well, i`m  working with SPI in a proyect with MC9S08GT32 cpu
The problem i have is that i can`t find the facts that debugger gives me  to be consistent with explanation of the datasheet.
First,  after  after writing the data register the one  which sends data to the transmit register,  the debugger always show me the value of the data register to be null.
Second, the secuence i see when I simule  the next piece of code is,

sending secuence
 while ( 1 ){
        while ( ! SPI1TF) ;
        SPI1D =0xFF;                 /* writes the transmit buffer register of spi */

the transmit empty flag is set in 0 value after writing two consecutive bytes, and i think it should be set 0 value after 1 writing . Another problem is when the flag is finally set  to 0, it never comes back to 1 value (ready to trasmit another byte)

I really think that the secuence to send a byte is, seeing if the transmit empty  flag is set, then write the data register, and the is suposed that the thata is send after 8 spi clock times. and then repeat the cycle.

well the only
thing i can see is that the SPI is not working, if someone can help me, send me a piece of code that  has used succsesfuly, please i need some help



Added p/n to subject.

Message Edited by NLFSJ on 2008-09-29 12:09 PM