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

Re:LPC17xx spi simulation

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

Parents
  • 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

Reply
  • 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

Children