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

C8051F120 SPI communication

Hi,
I am trying SPI communication between two C8051F120.
Master and slave in 3 wire mode config.
first time master sends data correctly but second time it get shifted by 1 bit.
Please help me for same.

Parents
  • Are you in control of the protocol, having written the source for both sides?

    You should use the slave select to synchronize the two sides. If you don't, then every single little noise pulse on the clock line will make the master and slave run unsynchronized.

    Your problem right now is probably your configuration of default state for the clock signal between transfers (note that for SPI you have four possible configurations for the clock. Which phase to clock data on, and what level to use when paused).

    But you have to think about both configuring the clock line correctly on both sides, and using the slave select to synchronize the slave.

Reply
  • Are you in control of the protocol, having written the source for both sides?

    You should use the slave select to synchronize the two sides. If you don't, then every single little noise pulse on the clock line will make the master and slave run unsynchronized.

    Your problem right now is probably your configuration of default state for the clock signal between transfers (note that for SPI you have four possible configurations for the clock. Which phase to clock data on, and what level to use when paused).

    But you have to think about both configuring the clock line correctly on both sides, and using the slave select to synchronize the slave.

Children