1

I have i2c ADC MAX11646(to detect the temperature using LM35), trying to interface with Raspberry Pi through I2C. i2cdetect -y 1 shows the connected i2c devices.

Now I cannot read the ADC values. I've use i2cset -y 1 0x36 0x21 to set the channel 1 and tried i2cget -y 1 0x36 to read the data.

its always returns oxfc . The channel 2 output is always oxff

How can I get the proper result. Any help is appreciated .

2
  • 1
    The datasheet for the device will specify the commands you send, the data returned, and how to interpret the data.
    – joan
    Dec 9, 2016 at 9:15
  • The datasheet doesn't provide any register address to access the ADC output. So I think we just need to access it using the device i2c address. But that's not working in my case
    – Sam
    Dec 9, 2016 at 10:58

1 Answer 1

3

As @joan says, the datasheet will help you ...

...The result is transmitted in 2 bytes; first 6 bits of the first byte are high, then MSB through LSB are consecutively clocked out.

So, the first 6 bits are high, hence the values you'll see in the first byte can only be 0xFC to 0xFF.

You need to read 2 bytes instead of 1. I don't think i2cget can do that (without specifying the register address). You might have some luck with i2cdump.

Maybe: i2cdump -y 1 0x36 w

5
  • i2cdump showed me a lot of data on the screen. What is it actually? Is it the register output? How really can I get the 10 bit output ?
    – Sam
    Dec 9, 2016 at 11:04
  • really sorry to ask u a lot, I'm a newbie and dont have much knowledge in this.
    – Sam
    Dec 9, 2016 at 11:09
  • 1
    It is just a dump of values requested from the device (some may be invalid / non existant). I'd be interested in the first value - that might contain your reading. However, to get the actual 10bit output you really need to do some coding - python, c, whatever, as long as it provides access to i2c Dec 9, 2016 at 11:10
  • Oh thankyou for the prompt reply. What does the top row actually mean at the output of i2cdump
    – Sam
    Dec 9, 2016 at 11:16
  • 1
    @Sam man i2cdump
    – joan
    Dec 9, 2016 at 11:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.