This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMP126-Q1: Integration trouble, reading strange results with two separate devices.

Part Number: TMP126-Q1
Other Parts Discussed in Thread: TMP126

Hi there,

I recently added the TMP126-Q1 to a few PCBs but upon attempting to communicate with it, I'm receiving strange values. 

On my first go I routed the traces to an FTDI Serial Cable, C232HM-EDHSL-0, and attempted to use SPI to communicate However, the DLL provided with the cable only gave read/write functions without a simultaneous transfer option so I thought maybe the CS was being turned back high between command and host read packets. See attempt below:

I then tried using an arduino nano as it seemed their SPI libraries were a bit easier to work with. I used Josh Wyatt's example as a base but received similar results- strange readings that didn't match with any logical temperature reading. See attempt below:

I was hoping you could have a look and give some insight as to why I'm getting these strange readings. Thanks!

  • Hi Anthony,

    Please verify you have connected the controller's output to a resistor, and connected this with the controller's input to the TMP126's SIO as shown here.

    On your Arduino attempt, 16MHz is too fast. The TMP126 is specified for 10MHz max. The current-limiting resistor is going to make it difficult to achieve high speeds; I would recommend testing at 500kHz or no more than 1MHz initially. 

    Due to the combined output, you must write 0xFF when you are expecting a response from TMP126. Please change the transfer code back to 0xFF.

    I would also recommend taking a look at your bus activity using a logic analyzer or oscilloscope. 

    thanks,

    ren

  • Hi Ren- thanks for the quick answer. I apologize for needing quite a bit of handholding.

    I had the 10k resistor inline with the MOSI line coming from the arduino as the diagram requests- but left out the capacitor between the voltage/ground and the resistor between alert/voltage as I didn't think I needed either of them for initial testing.

    I've dropped down the frequency to 500kHz and changed the two write values to 0xFF as you recommended which all makes sense. It's reacting better to that now and not just feeding me garbage E0 values- but still giving me strange reading. So if I write 0xFF it'll read back FF on both bytes as expected when unplugged but when plugged in it'll read 7F and FF.

    The SIO is quite tough to probe into given the location with my setup, but with an oscilloscope hooked up to the MOSI and MISO pins it produces the following graphs:

    MOSI signal unplugged from thermistor:

     

    MOSI signal plugged into thermistor:

    MISO signal unplugged from thermistor:

    MISO signal plugged into thermistor:

    All looks healthy signal wise, just not getting the expected input.

    Here the code in txt format if that's better for you:

    #include <SPI.h>

    unsigned char byte1;
    unsigned char byte2;
    //PINOUTS
    #define CSpin 10 //ss
    #define DATAout 11 //MOSI
    #define DATAin 12 //MISO
    #define SCLK 13 //SCLK
    #define Alert 8 //Status 1

    #define CSpin 10

    void setup() {
    // put your setup code here, to run once:
    pinMode(CSpin, OUTPUT); //set CS/SS as output
    SPI.begin(); //init SPI library
    Serial.begin(9600);
    }

    void loop() {
    // put your main code here, to run repeatedly:
    SPI.beginTransaction(SPISettings(500000, MSBFIRST, SPI_MODE0)); //SPI settings (speedMaximum, dataOrder, and dataMode), Nano is 16MHz max
    digitalWrite(CSpin, LOW); //set CS/SS LOW
    SPI.transfer(0x01);
    SPI.transfer(0x00); //address
    byte1 = SPI.transfer(0xFF);
    byte2 = SPI.transfer(0xFF);

    digitalWrite(CSpin, HIGH);
    SPI.endTransaction();

    float t126 = (((int16_t) byte1 << 8 | byte2) >> 2) * 0.03125;

    delay(1000);

    Serial.print("byte1:");
    Serial.print(byte1, HEX);
    Serial.print(", byte2:");
    Serial.print(byte2, HEX);
    Serial.print(", temp:");
    Serial.print(t126);
    Serial.println("C");

    }

  • Could you please confirm that you receive 0x0126 when sending 0x010C? This is the Device ID register, and should always report the same value regardless of configuration.

    thanks,

    ren

  • Err, nope, still just getting FF for both bytes even when changing it to 0x010C and verifying/uploading.

    I can rewire everything, but I'm pretty sure everything is correct hardware-wise.

  • The 0xFF response implies TMP126 did not respond at all. Please use your oscilloscope to look for ringing. You will need to "zoom in" to a much smaller time scale to see the clock cycles. You will likely need to add series resistance (~50ohms) to stop the ringing caused by your wiring. Since TMP126 supports 10MHz, it will not filter high-frequency noise, and will be confused by all the activity it perceives. 

    ren

  • Probing at the arduino itself the signal itself did look a bit muddled, but after slowing down the clock speed to 100kHz it looks like a rather clear signal:

    So yesterday I contracted some coworkers and we took apart the entire system. Turns out a we were given a different external part with the wrong pinout so we were sending VCC to CLK, CLK to Alert, GND to VCC, etc. Then, after we rewired based on continuity.. magic!

    As the device ID I get 0x2126 instead of 0x0126, but when I attempt to read temperature register I get good readings which increase/decrease when you put your thumb on the chip.

    Sorry for bringing you down this rabbit hole with me when there was nothing wrong with the chip to begin with.

  • I'm glad you resolved your problem. It turns out my TMP126 prototype responds 0x0126 while production TMP126 will respond 0x1126 and TMP126-Q1 responds 0x2126.

    ren