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

Interfacing Temperature Sensor to board

Hi,

We would like to issue a command serially from master to slave but we don't know how. We are trying to interface a temperature sensor to the board and we got stuck on how to control the clock pulse given by the Master so that we can input 8 bits one at a time. Does this clock pulse have to be controlled by a delay or do we have to use some PWM? Once we establish this, how do we actually indicate that one bit per clock cycle should be processed at a time?

Thanks!

Parents
  • No. SPI is not Dallas/Maxim one-wire protocol. SPI is a third protocol and most definitely don't have "one wire" - you have MOSI, MISO, SCLK and SSEL. For SPI, you have very little timing issues - with many devices you only have a maximum speed (i.e. minimum setup and hold times) but you can freeze the time. SPI is a synchronous protocol - everything is synchronized with the clock signal that the master generates.

    And just as with I2C, lots of microcontrollers have dedicated hardware for SPI communication. But it is also trivial to implement the server (but very much not slave!) side in software, just toggling pins and wait a while.

    So have you checked if you really do need to run SPI in software or if your processor have hardware support for SPI?

    Next - exactly what issues do you see with creating the required delays? Microcontrollers are normally very well adapted for generating the required delays.

Reply
  • No. SPI is not Dallas/Maxim one-wire protocol. SPI is a third protocol and most definitely don't have "one wire" - you have MOSI, MISO, SCLK and SSEL. For SPI, you have very little timing issues - with many devices you only have a maximum speed (i.e. minimum setup and hold times) but you can freeze the time. SPI is a synchronous protocol - everything is synchronized with the clock signal that the master generates.

    And just as with I2C, lots of microcontrollers have dedicated hardware for SPI communication. But it is also trivial to implement the server (but very much not slave!) side in software, just toggling pins and wait a while.

    So have you checked if you really do need to run SPI in software or if your processor have hardware support for SPI?

    Next - exactly what issues do you see with creating the required delays? Microcontrollers are normally very well adapted for generating the required delays.

Children