This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

SPI error

Hello Friends,

I defined an SPI interface, µc as master and
only one salve, I cannot see clock generating at SCK0...I tested with
Oscilloscope....Please you check the code ..and where am I doing error
???

void init_spi(void)
{
S0SPCCR = 0x08; /* SPI clock */
S0SPCR = 0x60; /* µc as master, LSB as first bit, CPOL = 0, CPHA
= 0 */
IOSET1 = 0x00010000; /* Blink LED */
}
int init_spi_write(void)
{
S0SPDR = 0x01; /* Write Data Address to SPI */
while ((S0SPSR & 0x80) == 0); /* Wait Until SPIE bit is set */
IOSET1 = 0x00100000; /* Blink the LED */
return (S0SPSR); /* When SPIE is Set, read the Status register*/
}
int init_spi_read(void)
{
unsigned int dummy;
dummy = S0SPDR /* Read the value from SPI */
while ((S0SPSR & 0x80) == 0); /* wait until SPIE bit is set */
IOSET1 = 0x00200000; /* Blink the LED */
return (S0SPSR); /* When SPIE bit is set read Status Register */
}
int main (void)
{
initial_serial(); /* Initialize the Serial Interface with UART */
PINSEL0 |= 0x00005500; /* SCK0, MISO, MOSI for SPI0 enabled &
SSEL*/
IODIR0 = 0x00003C00; /* P.10.. P.13 defined as outputs */
IOSET0 = 0x00001400; /* p.10, p.12 high & P.11, p13 are low to
select CS*/
IODIR1 = 0x00FF0000; /* Define P1.16 to P1.23 as outside */
IOCLR1 = 0x00000000; /* Turn off LEDs, you can check your flash
is working or not */
init_spi(); /* Initialize the SPI Interface */
init_spi_write(); /* Write the data to SPI */
init_spi_read(); /* Read data from SPI data register */

}

I made High on SSLE ...P0.7 to 3.3v........Still I dont see any clock
generating st SCK0 nor any signal at MOSI or MISO.......

I am waiting for your replies,

Thanks in Advance,

Sridhar

0