Thanks for your reply. i found the problem. As u rightly pointed out the problem was with the settings. i have some questions first is that SPDR register value never changes why is that? second what is spi_out? is this signal same as MOSI? thanks again for ur reply
regards
Thanks for your reply. when i tried to run the following program i never got any value set in SPDR register at any point of time.
while(1) { LPC_SPI->SPDR = byte; byte++; while(!(LPC_SPI->SPSR & 0x80)); }
then i used the following simulation script for SPI_IN
signal void spi_func (void) { while (1) { wwatch (SPI_OUT); printf ("SPI_OUT: %2.2X\n", (unsigned) SPI_OUT); SPI_IN = SPI_OUT + 1; } }
with following program
LPC_SPI->SPDR=byte; while(!(LPC_SPI->SPSR & 0x80)); byte=LPC_SPI->SPDR;
I see the changes in SPDR whenever i am receiving data but not when sending the data.
Thanks again for your reply. Regrads
I think you did not quite understand writing to SPDR register twice consecutively, that would mean
LPC_SPI->SPDR = byte; LPC_SPI->SPDR = byte;