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.

F28377D I2C Temperature Sensor Address Issue

I am running a F28377D with a DS1775R+U temperature sensor attached to GPIO pins 0 and 1.

When I start my system, I am simply trying to read the base address of the sensor. The DS17775R+U is designed to continually place temperature data on the line on a read command unless otherwise configured. However, when I run my system, I see what looks to be an address being sent but I always miss the MSB of the address. I am using an I2C sniffer and when I try to send an address of 0x91(read), I get back 0x11 and when I send 0x90(write, I get back 0x10. Looking at the capture of the signal below, the clock doesnt look correct and could be the cause of the missing bit issue. All the timing diagrams that I see have the clock at a steady high value but mine always stays idle low. Is there a configuration setting to change that? Or looking at the code below does anyone see something incorrect that would cause me a bad address on the line.

Below is my I2C initialization and then the code that I am using to try and read the data.

//Disable I2C during setup
I2caRegs.I2CMDR.bit.IRS = 0;

EALLOW;
/* Enable internal pull-up for the selected I2C pins */
GpioCtrlRegs.GPAPUD.bit.GPIO0 = 0;     // Enable pull-up for GPIO0 (SDAA)
GpioCtrlRegs.GPAPUD.bit.GPIO1 = 0;     // Enable pull-up for GPIO1 (SDLA)

/* Set qualification for the selected I2C pins */
GpioCtrlRegs.GPAQSEL1.bit.GPIO0 = 3;   // Async/no qualification (I/ps sync
GpioCtrlRegs.GPAQSEL1.bit.GPIO1 = 3;   // to SYSCLKOUT by default)

/* Configure which of the possible GPIO pins will be I2C_A pins using GPIO regs*/
GpioCtrlRegs.GPAGMUX1.bit.GPIO0 = 1;   // Configure GPIO0 for SDAA operation
GpioCtrlRegs.GPAMUX1.bit.GPIO0 = 2;    // Configure GPIO0 for SDAA operation

GpioCtrlRegs.GPAGMUX1.bit.GPIO1 = 1;   // Configure GPIO1 for SDLA operation
GpioCtrlRegs.GPAMUX1.bit.GPIO1 = 2;    // Configure GPIO1 for SDLA operation
EDIS;

//module clock frequency = I2C input clock frequency/(IPSC+1)
//module clock must be between 6.7-13.3MHz
I2caRegs.I2CPSC.all = 0x0013; // Prescaler - bring 200MHz clock to 10MHz
I2caRegs.I2CCLKL = 0x002D;    // SCL frequency of 100kHz
I2caRegs.I2CCLKH = 0x002D;    // 50% duty cycle so CLKL and CLKH match

I2caRegs.I2CIER.all = 0x0000;     // Disable interrupts

I2caRegs.I2CMDR.bit.IRS = 1;  // Take I2C out of reset


***Runs in a loop to read data***
// Make sure no other transaction on bus
while (I2caRegs.I2CMDR.bit.STP != 0);

I2caRegs.I2CSAR.all   = 0x0091;

I2caRegs.I2CCNT = 2;  // Setup how many bytes to expect
I2caRegs.I2CMDR.all = 0x2C20;

while(!(I2caRegs.I2CSTR.bit.RRDY || I2caRegs.I2CSTR.bit.ARDY));

temperature[0] = I2caRegs.I2CDRR.all;
temperature[1] = I2caRegs.I2CDRR.all;

  • Matthew,

    By default, the I2C module uses 7-bit addresses. It looks like your sensor expects a 10-bit address. To use 10-bit addresses, set the XA bit in the I2CMDR register.

  • I am not sure that I agree with the 10 bit address. I looked at the data sheet for the part(datasheets.maximintegrated.com/.../DS1775-DS1775R.pdf) and it certainly looks like a 7 bit address with an 8th bit to tell it read/write. According to the sheet, it looks like I would used 10010001(0x91) if I wanted to read from the device as a slave. Did you see something that says otherwise?
  • Hi Adam
    Seems that your device uses 7bit address. The address is 0x48 (1001000b), the read bit is appended to the address by the i2c module (when reading = 1, Writing = 0). Try with SAR.all = 0x48.
    Regards,
    Roger
  • Matthew,

    You're right, that is what the datasheet says. I was confused by your notation. There are two different ways of writing I2C addresses. The I2CSAR register expects data in 0x7f format, where the address bits are right-aligned. The read/write direction is determined by the I2CMDR.TRX bit, and is not technically part of the address.

    The other way of writing the address is 0xfe format, which left-aligns the address to mimic the 8-bit address byte from the start of an I2C transfer.
  • Dear Matthew Argiro,

    Are you still having the same problem with the reading from your I2C sensor? I have TMP423A temperature sensor and I can not read the local temperature from the sensor, however, I followed the procedure presented in the example of control suit. However, when I look to the SCL in the oscilloscope it is just 0 level!!! Another issue that the output level of GPIO 3.3 V of the F28377D and the temperature sensor level is 5V is that make any issue?

    Thanks

  • Hello,

    Please consider creating a new post as old posts are generally closed and no longer tracked. You can provide the necessary information regarding your issue in the new post and include a link to this post if you'd like.

    Thanks,
    Elizabeth