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
  • And both of you seems to have a problem even knowing what protocol(s) you are talking about.

    It would be my guess that it's the Dallas/Maxim one-wire protocol. In that case, the hw sensor don't care what peripherial hardware in the microcontroller that generates the pulses. But you need to select a method that guarantees the timing, since that protocol is 100% controlled by time.

    Or might you instead be talking about the I2C protocol? Then it's quite common that the processor have hw support, in which case you only need to write a state machine to drive the communication.

Reply
  • And both of you seems to have a problem even knowing what protocol(s) you are talking about.

    It would be my guess that it's the Dallas/Maxim one-wire protocol. In that case, the hw sensor don't care what peripherial hardware in the microcontroller that generates the pulses. But you need to select a method that guarantees the timing, since that protocol is 100% controlled by time.

    Or might you instead be talking about the I2C protocol? Then it's quite common that the processor have hw support, in which case you only need to write a state machine to drive the communication.

Children
  • For an SPI protoc0l (Dallas/Maxim one-wire protocol), how can one control the timing generated by our SCLK ?

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

  • "we must use pwm as master?"

    Why do you feel PWM have anything to do with this? What datasheets have you read that indicates a need for PWM? More importantly - you haven't even mentioned what processor. Don't you think the actual processor will affect any answer of what to use to generate a specific signaling?

    Next thing - are you part of a tag team? In that case, you should be able to bounce ideas with your tag team partner. Exactly what conclusions have you come to, after carefully analyzing your situation?

  • how many clocks can we use? 12 or 14?

  • we're using the evaluation board MCB 2300 and trying to interface an SPI temperature sensor with the board. The temperature must then be displayed on the LCD.

  • "how many clocks can we use? 12 or 14?"

    Buy every clock you can lay your hands on. But what have that with SPI communication to do? Or with the temperature sensor?

  • So since the user manual for the LPC23xx processors very clearly describes the availability of SPI communication in hardware (not just the SPI peripherial but also through the more advanced SSP device - Synchronous Serial Port) the question must then be: Exactly where are you stuck? What issues do you see with using the hw functionality of the LPC23xx processor to communicate with your specific temperature sensor?

    Why did you bring in PWM, when the SPI peripherial in the processor explicitly clocks one bit for every pulse of the clock signal?

    The documentation in the user manual is very good. And there are also code bundles available for the processor. What work have _you_ invested on this problem of yours?