 | Discussion Forum |  |
|
|
Re:LPC17xx spi simulationNext Thread | Thread List | Previous Thread Start a Thread | Settings | Details | Message |
|---|
Read-Only Author Rahul Sen Posted 17-Mar-2010 20:24 GMT Toolset ARM |  Re:LPC17xx spi simulation Rahul Sen 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 | | Read-Only Author while (1); Posted 18-Mar-2010 16:51 GMT Toolset ARM |  RE:LPC17xx spi simulation while (1); As I already explained once you write to SPDR it automatically transmits data to shift register and it is not seen in SPDR any more, try making 2 consecutive writes to SPDR. SPI is not simulated on bit level so MOSI and MISO pins are not really toggling depending on the data but instead virtual registers are used SPI_IN and SPI_OUT. So you can think of SPI_OUT as data that is sent and SPI_IN as data received. | | Read-Only Author Rahul Sen Posted 22-Mar-2010 06:52 GMT Toolset ARM |  RE:LPC17xx spi simulation Rahul Sen 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 | | Read-Only Author while (1); Posted 22-Mar-2010 19:58 GMT Toolset ARM |  RE:LPC17xx spi simulation while (1); I think you did not quite understand writing to SPDR register twice consecutively, that would mean
LPC_SPI->SPDR = byte;
LPC_SPI->SPDR = byte;
| |
Next Thread | Thread List | Previous Thread Start a Thread | Settings |
|