Can AT89C2051 be used as a slave device for SPI

Hi, I have to design a circuit using AT89C51 with no hardware SPI and use it as SPI master. The SPI slave device I am using is AT89C2051 which is controlling the RTC chip DS1307 using I2C protocol. When ever a particular event occurs the AT89C2051 records the timing registers. These RTC registers need to read by the master controller that is AT89C51 from the slave AT89C2051 using SPI protocol.

So by basic doubt is whether can I use AT89C2051 slave without a hardware SPI. Can I implement the whole of the SPI protocol between Master and the slave using software SPI.

Raghu

Parents
  • It is trivial to implement a SPI master in software.

    It is a lot harder to implement a SPI slave in software, since the slave must be fast enough to not miss individual bits.

    What approximate baudrate do you need to be able to transfer the generated data?

    Unless you are going to use long signal lines between the two chips, the easiest thing is to do emit the bits of each word transfer either in a loop or unrolled for the individual bits. Since SPI is clocked by a separate signal, you don't even have to worry about an interrupt arriving and increasing the length of a bit cycle.

Reply
  • It is trivial to implement a SPI master in software.

    It is a lot harder to implement a SPI slave in software, since the slave must be fast enough to not miss individual bits.

    What approximate baudrate do you need to be able to transfer the generated data?

    Unless you are going to use long signal lines between the two chips, the easiest thing is to do emit the bits of each word transfer either in a loop or unrolled for the individual bits. Since SPI is clocked by a separate signal, you don't even have to worry about an interrupt arriving and increasing the length of a bit cycle.

Children
More questions in this forum