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!
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.
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?