TCS34725 I2C NAK Problem

Discussion in 'Embedded Systems and Microcontrollers' started by jamus, Mar 26, 2015.

  1. jamus

    Thread Starter Member

    Feb 11, 2013
    53
    0
    I purchased a TCS34725 color sensor from adafruit :https://www.adafruit.com/products/1334
    datasheet: http://www.adafruit.com/datasheets/TCS34725.pdf

    I have asked this question on their forum, but I like this place better.

    I am trying to communicate with this sensor via I2C at 100khz. The attached image shows what I am seeing on my logic analyzer.

    I sent the device address 0x29 with a write bit (0) appended. The device does not acknowledge. What are some reasons for the device not acknowledging?
     
    • i2c.PNG
      i2c.PNG
      File size:
      15.5 KB
      Views:
      19
    Last edited: Mar 26, 2015
  2. Papabravo

    Expert

    Feb 24, 2006
    10,138
    1,789
    I see a valid START condition, but I seem to remember that you need to send a STOP condition first especially after power up.
    Your address looks like the 7 LSB's of 0x29 followed by a zero for write.

    Are you bit-banging this or does your micro have I2C hardware?

    See state diagram in figure 6 of datasheet. Is PON disabled?

    You might have to figure out how to RESET the device, if you suspect that the internal registers are not in their default state.
     
    Last edited: Mar 26, 2015
  3. jamus

    Thread Starter Member

    Feb 11, 2013
    53
    0
    So you are saying that the device requires a stop condition after startup? Interesting.

    My uc has some pretty complex I2C hardware that I have to write the driver for myself.
     
  4. Papabravo

    Expert

    Feb 24, 2006
    10,138
    1,789
    It's just a hunch. In the early days of I2C experimentation it was not uncommon for the peripheral devices to get confused as we tried to learn the protocol and their quirks. The rule was a STOP condition was valid in ALL circumstances. A START condition might work in some cases and not in others. I'll be fascinated to hear your results.
     
  5. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    The packet looks good to me for a slave address of 29. Are you sure of the part number? The '25 and '27 take 0x29, the '21 and '23 take 0x39.

    As long as both SDA and SCL are high then a STOP is valid (and possible), though I cannot see why it is needed, START is START.

    I've had problems (only during debugging) where a device was stuck in ACK so SDA was low: clocking the SCL 9 times will always free this up so a START is possible.
     
  6. jamus

    Thread Starter Member

    Feb 11, 2013
    53
    0
    Ok guys, I think I have found the root of my problem, but I am not sure what to do yet. I looked at the waveforms on my scope, and they were 0.4v waveforms. Take a look at this schematic and tell me what you think I should do. light_colorsenseschem.png
     
  7. Papabravo

    Expert

    Feb 24, 2006
    10,138
    1,789
    What exactly does "0.4v waveforms" mean?
    Were they stuck at 0.4V
    Were they beating up and down with an amplitude of 0.4V? In this case it sounds like faulty pullups. Your drawing with gray text on a white background is really hard to read.
     
  8. jamus

    Thread Starter Member

    Feb 11, 2013
    53
    0
    The logic high voltage on the line is 0.4v. I basically thought it was faulty pullups too. But if you look at the schematic from the company that I posted, they seem to have some sort of complex scheme that allows the device to be used at 5v.

    When I supply the 3v3 pin on the header with 3.3v rather than using the onboard regulator, the logic high voltage on the line is 3.3v. I looked the SDA line on my scope. I see 3.3v waveforms now. I also see the NAK, but it doesn't pull the line down far enough. It only pulls the line down by about a volt.
     
  9. Papabravo

    Expert

    Feb 24, 2006
    10,138
    1,789
    Well that sounds like the pulldown driver is not strong enough to sink the required current. Do the values on the parts match the values on the schematic.
    I2C has rules about minimum and maximum values for the pullups.

    BTW what are those FETs doing on the SDA/SCL lines? The I2C physical layer is very brittle. Every time I've seen people screwing around trying to be clever, I2C turns around and bites them on the ....well you know.

    Are the 5V and 3.3V pullups fighting each other?
     
  10. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    The Adafruit board has pullups for the 5V I2C bus, if you use these don't add a 2nd (or 3rd) set anywhere else.

    If you just give that board 5V does 3.3V come out? If not the on board regulator is blown.

    I read an app note I believe from Phillips (NXP) on using fets as bus level translators. I have seen them used in several projects but when I need such translation I buy an integrated chip to do it and that has not failed me.
     
Loading...