SPI with bi-directional data line

18 Jan 2011

Hi all,

I am using the TMP124 temperature sensor from TI, and it has a bi-directional data line that must be written to and read from to use the device. I have done some searching on the forums and haven't found a topic on this subject, so if I may ask...

Should I bit-bang the serial port or is there an easier way?

Here is the datasheet for the part.




18 Jan 2011 . Edited: 18 Jan 2011

Some links that might help. I'm new to SPI also so I might not be much help.


http://mbed.org/handbook/Homepage (under Networking & Comms)



18 Jan 2011

The SPI uses MOSI and MISO, two lines to transfer the data, it's not bi-directional. So I think your going to have to go with bit-bashing. I'm pretty sure I saw somewhere here in the forums or projects examples of using DigitalInOut to do this, just can't remember where now.

18 Jan 2011

I think you're right, a real "SPI" would have mosi and miso, so it looks like this is some proprietary serial. Bit-bashing seems to be the easiest solution.

18 Jan 2011

As long as you only want to read the temperature, and don't need to write configuration values, you can use it as a normal SPI device. You just need to make sure you pull /CS high after each 16-bit read.

18 Jan 2011


Not sure if you've seen, but we provide an interface called:

I'm hoping this could be exactly what you want! You just tie mosi and miso together when you wire it up, and the library should take care of the rest.


18 Jan 2011

Thanks Simon!

I was considering connecting mosi and miso together. It makes sense why you can do this.