# WP7702 I2C raspberry pi connection issue

**URL:** <https://mangoh.discourse.group/t/wp7702-i2c-raspberry-pi-connection-issue/1658>\
**Category:** mangOH Red\
**Created:** [July 3, 2018, 8:45pm UTC](https://mangoh.discourse.group/t/wp7702-i2c-raspberry-pi-connection-issue/1658 "2018-07-03T20:45:14Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![chinnaobi](https://avatars.discourse-cdn.com/v4/letter/c/898d66/32.png) [@chinnaobi](https://mangoh.discourse.group/u/chinnaobi)\
**Post date:** [July 3, 2018, 8:45pm UTC](https://mangoh.discourse.group/t/wp7702-i2c-raspberry-pi-connection-issue/1658/1 "2018-07-03T20:45:14Z")

</div>

I have connected an i2c sensor to raspberry pi i2c connectors (SDA, SCL). The address of the sensor is 0x5A. However, the sensor is not being detected.

Following is the output of ls -l /dev/i2c\*

![image](https://us1.discourse-cdn.com/flex016/uploads/mangoh/original/1X/7226702280d462f2d7a225bfced5929bc0372619.png)

Where can I find which i2c port belong to SD3 SC3 ports?

Also when I tried to detect the sensor using i2cdetect -y -r

 ![image](https://us1.discourse-cdn.com/flex016/uploads/mangoh/original/1X/c0a27aa7d69972897bc9fccff4ffbb5e49833092.png)

All the ports are showing error. How to verify the i2c device is detected and how to read values of the sensor?

By the way, I am using the latest version of firmware.  
cm info output

 ![image](https://us1.discourse-cdn.com/flex016/uploads/mangoh/original/1X/07bd8bc6aa82adb583c790356e96a0036f192d60.png)

In that always shows some i2c errors., not sure what they are.

I am new to arm processor and legato please bear with me.

@asyal @dfrey any inputs ?

---

<div class="post-metadata">

**Author:** ![fgodfrey](https://avatars.discourse-cdn.com/v4/letter/f/f475e1/32.png) [@fgodfrey](https://mangoh.discourse.group/u/fgodfrey)\
**Post date:** [July 3, 2018, 11:16pm UTC](https://mangoh.discourse.group/t/wp7702-i2c-raspberry-pi-connection-issue/1658/2 "2018-07-03T23:16:07Z")

</div>

Your device should appear on Bus 8. Bus 4 is the bus coming out of the SoC and 5, 6, 7 and 8 are the sub-busses off the switch.

I was also unable to use the quick-write version of i2cdetect, but the read version worked fine. I did get the slave not responding errors which made the console output unusable, but if I did:  
i2cdetect -y -r 8 \> /tmp/detected

I got a useful piece of output and the device was where I expected it to be with no problems. You could also ssh in and run i2cdetect to not have the spurious errors.

---

<div class="post-metadata">

**Author:** ![chinnaobi](https://avatars.discourse-cdn.com/v4/letter/c/898d66/32.png) [@chinnaobi](https://mangoh.discourse.group/u/chinnaobi)\
**Post date:** [July 4, 2018, 12:06am UTC](https://mangoh.discourse.group/t/wp7702-i2c-raspberry-pi-connection-issue/1658/3 "2018-07-04T00:06:32Z")

</div>

Thanks for the reply it does seem to output sensible information upon using SSH shell.

![image](https://us1.discourse-cdn.com/flex016/uploads/mangoh/original/1X/5df26f4d93b9236160900b1591892c0512e96316.png)

However, the i2c slave address of the sensor is 5a but the ouput is not showing that address.  
 ![image](https://us1.discourse-cdn.com/flex016/uploads/mangoh/original/1X/2c44be28b4257b91222372ef115e26229a23acba.png)

any ideas

---

<div class="post-metadata">

**Author:** ![fgodfrey](https://avatars.discourse-cdn.com/v4/letter/f/f475e1/32.png) [@fgodfrey](https://mangoh.discourse.group/u/fgodfrey)\
**Post date:** [July 4, 2018, 2:46am UTC](https://mangoh.discourse.group/t/wp7702-i2c-raspberry-pi-connection-issue/1658/4 "2018-07-04T02:46:46Z")

</div>

So, because of the way I2C works, everything on bus 4 is going to also appear to be on any of the busses downstream of the switch. So, your output is identical to mine (except my own device appears, as expected, on bus 8, on my board). My strong suspicion is that your device is in some way not working and that the mangOH is fine. i2cdetect is showing you that there’s a Linux driver loaded for the I2C switch (at address 0x71 on bus 4 and all other buses) and i2cdetect is fundamentally working. There’s not a lot that could be wrong with those symptoms other than your device having some connectivity issue.

I suppose it’s _possible_ that the two zero-ohm resistors (R365 and 366) are somehow missing on your board but they certainly weren’t on mine (I ordered mine from Digikey).

To check the board, check to make sure the two I2C pins on the Raspberry Pi connector are both pulled to 3.3 volts. If they are, then the problem is almost certainly after that point. If they aren’t then there’s likely a physical problem with your board.

As for your second screen grab (i2cdetect using “write” mode), that does not work on this master interface. Not sure why, but read mode works fine.

For comparison’s sake, here’s my software versions:  
Device: WP7702  
IMEI: 352653090112913  
IMEISV: 2  
FSN: VU810385470210  
Firmware Version: SWI9X06Y\_02.14.04.00 a03347 jenkins 2018/02/19 06:13:56  
Bootloader Version: SWI9X06Y\_02.14.04.00 a03347 jenkins 2018/02/19 06:13:56  
MCU Version: 002.007  
PRI Part Number (PN): 9907365  
PRI Revision: 001.004  
Carrier PRI Name: GENERIC  
Carrier PRI Revision: 001.012\_000  
SKU: 1103530  
Last Reset Cause: Power Down  
Resets Count: Expected: 52 Unexpected: 39

---

<div class="post-metadata">

**Author:** ![fgodfrey](https://avatars.discourse-cdn.com/v4/letter/f/f475e1/32.png) [@fgodfrey](https://mangoh.discourse.group/u/fgodfrey)\
**Post date:** [July 4, 2018, 2:53am UTC](https://mangoh.discourse.group/t/wp7702-i2c-raspberry-pi-connection-issue/1658/5 "2018-07-04T02:53:39Z")

</div>

Few other things to check, assuming your board is good:

- Is the device you’re trying to attach compatible with 3.3 volt inputs?
- Is it powered and is the common connected to the mangOH?
- Do you have any way of testing it against a known working board (like a real Raspberry Pi)?

---

<div class="post-metadata">

**Author:** ![chinnaobi](https://avatars.discourse-cdn.com/v4/letter/c/898d66/32.png) [@chinnaobi](https://mangoh.discourse.group/u/chinnaobi)\
**Post date:** [July 5, 2018, 12:38am UTC](https://mangoh.discourse.group/t/wp7702-i2c-raspberry-pi-connection-issue/1658/6 "2018-07-05T00:38:54Z")

</div>

@fgodfrey @asyal @dfrey

As suggested I have verified the voltage levels on Rasberry connector PIN 3(SDA-SD3) and PIN 5 (SCL-SC3)

Both showed 0.89 volts as shown in the below picture

 ![image](https://us1.discourse-cdn.com/flex016/uploads/mangoh/original/1X/83a938cd22b431f76003ea251338f6d8de84fa3a.jpg)

**Does it mean the board has hardware problem ??**

The sensor I am trying to test does not support 3.3v  
Yes it is powered as shown in the picture

 ![image](https://us1.discourse-cdn.com/flex016/uploads/mangoh/original/1X/cbe623b4afd06c2aa033a7aa82aa5227dfb6b7c5.jpg)

I have tested the sensor with Arduino works alright.

---

<div class="post-metadata">

**Author:** ![fgodfrey](https://avatars.discourse-cdn.com/v4/letter/f/f475e1/32.png) [@fgodfrey](https://mangoh.discourse.group/u/fgodfrey)\
**Post date:** [July 5, 2018, 2:11am UTC](https://mangoh.discourse.group/t/wp7702-i2c-raspberry-pi-connection-issue/1658/7 "2018-07-05T02:11:28Z")

</div>

Err, you’re not testing what you think you’re testing. You need to use the DC voltage setting on your meter, not the “Battery/Pile” setting, which will draw current to ground. It looks like your meter is set to draw 5mA which will drag the bus down since the pull-ups are about 250uA.

I would strongly recommend never using the Battery/Pile setting on that meter unless you know exactly why you’re doing it (see page 11 of the volt meter’s manual for details).

Also, when you say this: “The sensor I am trying to test does not support 3.3v”… The I2C bus voltage of the mangOH board is 3.3 volts so if the sensor doesn’t see that as a “high” (it _should_ but you don’t say what the sensor is so I can’t check the data sheet) then it isn’t going to work.

---

<div class="post-metadata">

**Author:** ![chinnaobi](https://avatars.discourse-cdn.com/v4/letter/c/898d66/32.png) [@chinnaobi](https://mangoh.discourse.group/u/chinnaobi)\
**Post date:** [July 5, 2018, 3:14am UTC](https://mangoh.discourse.group/t/wp7702-i2c-raspberry-pi-connection-issue/1658/8 "2018-07-05T03:14:27Z")

</div>

Sorry about that, this is a new multi meter I started to use. Indeed the voltage is 3.3v on SCL and SDA pins. Safe there not issues with the board.

I have got another model of the same sensor which supports 3.3v and I tested with arduino. After hooking it to MangoH Red the output of i2cdetect is exactly same as before. By the way the sensor I am testing is MLX90614 which has two models one 3.3 v and the other 5v.

@fgodfrey if the i2cdetect -y 8 doesn’t show up the address does it mean the sensor hasn’t responded with the discovery of the address ?

---

<div class="post-metadata">

**Author:** ![fgodfrey](https://avatars.discourse-cdn.com/v4/letter/f/f475e1/32.png) [@fgodfrey](https://mangoh.discourse.group/u/fgodfrey)\
**Post date:** [July 5, 2018, 3:24am UTC](https://mangoh.discourse.group/t/wp7702-i2c-raspberry-pi-connection-issue/1658/9 "2018-07-05T03:24:46Z")

</div>

Well, “quick write” mode doesn’t seem to work on the WP7702 so you need to do i2cdetect -r -y 8, but yes, if it doesn’t show up, it means the sensor didn’t respond. However, there ARE some devices that don’t respond correctly to detection but do work so you may want to try throwing some commands at it and see if it responds. The data sheet for your part indicates that there are some non I2C modes that can be programed as power-on defaults, but since you said it works fine with an Arduino, that’s almost certainly not your issue.

At this point, other than the possibility that it’s working fine and just not responding to detection (some devices fail to correctly acknowledge bytes sent to them), I am out of ideas. What you have _should_ work.

---

<div class="post-metadata">

**Author:** ![chinnaobi](https://avatars.discourse-cdn.com/v4/letter/c/898d66/32.png) [@chinnaobi](https://mangoh.discourse.group/u/chinnaobi)\
**Post date:** [July 5, 2018, 7:01pm UTC](https://mangoh.discourse.group/t/wp7702-i2c-raspberry-pi-connection-issue/1658/10 "2018-07-05T19:01:41Z")

</div>

For some reason the i2cdetect doesn’t work for MLX90614 however this command works

![image](https://us1.discourse-cdn.com/flex016/uploads/mangoh/original/1X/00cbbaf5d00adef9ae0f12b7c4dbd70a8b6b4b3a.png)

Reading from this [https://books.google.ca/books?id=PndJDAAAQBAJ&pg=PA162&lpg=PA162&dq=i2cget+wp&source=bl&ots=Qipcx10kCq&sig=bsrRqiLl2e-EfBJ2xmoNhcTDVo8&hl=en&sa=X&ved=0ahUKEwiupOWry4jcAhUkw4MKHWDFCBgQ6AEINjAC#v=onepage&q=i2cget%20wp&f=false](https://books.google.ca/books?id=PndJDAAAQBAJ&pg=PA162&lpg=PA162&dq=i2cget+wp&source=bl&ots=Qipcx10kCq&sig=bsrRqiLl2e-EfBJ2xmoNhcTDVo8&hl=en&sa=X&ved=0ahUKEwiupOWry4jcAhUkw4MKHWDFCBgQ6AEINjAC#v=onepage&q=i2cget%20wp&f=false)

Explains how to use i2cget and calculate temperature from the hex values.

@fgodfrey thanks for your support.

---

<div class="post-metadata">

**Author:** ![fgodfrey](https://avatars.discourse-cdn.com/v4/letter/f/f475e1/32.png) [@fgodfrey](https://mangoh.discourse.group/u/fgodfrey)\
**Post date:** [July 5, 2018, 8:36pm UTC](https://mangoh.discourse.group/t/wp7702-i2c-raspberry-pi-connection-issue/1658/11 "2018-07-05T20:36:38Z")

</div>

No problem! Glad you got it working! For what it’s worth, there’s a Linux driver for your thing if you’re interested that looks like it’ll do all the calculating for you and drop the values in /sys. I’ve never used this particular device though.

The reason some devices don’t respond to “detect” is because of the way it works. The protocol is that the master sends the device address to the slave. The slave is supposed to acknowledge by holding the bus low. However, some devices won’t acknowledge unless you send them a valid command and since i2cdetect doesn’t send a command, those devices won’t properly respond and thus won’t be detected. When you do i2cget you’re sending a valid command so the device acknowledges and you’re good to go.

---

<div class="post-metadata">

**Author:** ![awneil](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/awneil/32/486_2.png) [@awneil](https://mangoh.discourse.group/u/awneil)\
**Post date:** [July 6, 2018, 12:59pm UTC](https://mangoh.discourse.group/t/wp7702-i2c-raspberry-pi-connection-issue/1658/12 "2018-07-06T12:59:09Z")

</div>

> [@fgodfrey](#):
>
> The slave is supposed to acknowledge

The I2C Specification very clearly states that every single byte - including the address byte - **_must_** be acknowledged.

> **[UM10204.pdf](https://www.nxp.com/docs/en/user-guide/UM10204.pdf)**
>
> 733.36 KB

> [@fgodfrey](#):
>
> some devices won’t acknowledge unless you send them a valid command

So clearly a violation of the spec!

The Master should never start sending the next byte until the previous one has been ACKed.

Looks like these slaves are lying in claiming to be I2C !!

---

<div class="post-metadata">

**Author:** ![chinnaobi](https://avatars.discourse-cdn.com/v4/letter/c/898d66/32.png) [@chinnaobi](https://mangoh.discourse.group/u/chinnaobi)\
**Post date:** [July 6, 2018, 3:20pm UTC](https://mangoh.discourse.group/t/wp7702-i2c-raspberry-pi-connection-issue/1658/13 "2018-07-06T15:20:48Z")

</div>

> [@fgodfrey](#):
>
> /sys

I have written a simple tempReading app using the reference of the i2c/BatteryChargerReading tutorial under red. That is reading the values fine, however I haven’t used any drivers. This application uses i2c communication directly with the device without any drivers.

You mention a Linux driver which one is it where can I refer to ?

---

<div class="post-metadata">

**Author:** ![fgodfrey](https://avatars.discourse-cdn.com/v4/letter/f/f475e1/32.png) [@fgodfrey](https://mangoh.discourse.group/u/fgodfrey)\
**Post date:** [July 6, 2018, 4:28pm UTC](https://mangoh.discourse.group/t/wp7702-i2c-raspberry-pi-connection-issue/1658/14 "2018-07-06T16:28:07Z")

</div>

The Linux driver is for your specific device, the MLX90614:

> <https://github.com/torvalds/linux/blob/master/drivers/iio/temperature/mlx90614.c>

If you rebuild your kernel you can include it or build it as a loadable module.
