0
mboehmer

GPIO interferes with I2C

Recommended Posts

Armbianmonitor:

Hi,

I use the new kernel with I2CA being used for controlling some U/I meters and sensors.

There are three 1Wire masters included by overlay (and they work :) ):

> ls /sys/bus/w1/devices/
> 22-000000214032  28-00000a09aa8d  w1_bus_master2
> 28-00000a089919  w1_bus_master1   w1_bus_master3

I2C works also fine, all devices mounted so far are answering:

> i2cdetect -y 0
>      0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
> 00:          -- -- -- -- -- -- -- -- -- 0c -- -- --
> 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> 20: 20 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> 40: 40 41 -- -- -- 45 -- 47 48 -- 4a -- -- 4d -- --
> 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> 60: -- -- -- -- -- -- -- -- -- -- -- -- 6c -- -- --
> 70: -- -- -- -- -- -- 76 --

Then I access the GPIO subsystem to initialize one pin for power control:

#! /bin/sh
echo 475 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio475/direction
echo 0   > /sys/class/gpio/gpio475/value

After that, I2C access is screwed up, and no normal access possible:

> i2cdetect -y 0
>      0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
> 00:          03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f
> 10: 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f
> 20: 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f
> 30: 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f
> 40: 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f
> 50: 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f
> 60: 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f
> 70: 70 71 72 73 74 75 76 77

This is kind of a showstopper - anyone can help here? Seems that activating the GPIO subsystem is touching the I2C pins on J2, too.

 

Michael

Share this post


Link to post
Share on other sites
6 hours ago, mboehmer said:

Then I access the GPIO subsystem to initialize one pin for power control:


#! /bin/sh
echo 475 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio475/direction
echo 0   > /sys/class/gpio/gpio475/value

After that, I2C access is screwed up, and no normal access possible:

Which board it is ?

GPIO-475 seems to be GPIOX_5, but on my NanoPiK2, it is connected to WiFi SDIO ...

On your board, what it is connected to ?

Share this post


Link to post
Share on other sites
Just now, martinayotte said:

Which board it is ?

GPIO-475 seems to be GPIOX_5, but on my NanoPiK2, it is connected to WiFi SDIO ...

On your board, what it is connected to ?

I use an Odroid C2, GPIO-475 should be X_5, and is connected as spare GPIO line to J2.

Schematics

I have latest board revision.

 

For me it seems that touching GPIO sets all GPIOs to zero (or overrides the I2C access? don't know, need to measure by scope).

Including the 1Wire masters doesn't affect the GPIOs, troubles start once I export the GPIO_475.

 

In case I can test something for you please let me know!

Share this post


Link to post
Share on other sites
3 minutes ago, mboehmer said:

In case I can test something for you please let me know!

Did you try to see if same behavior happened with some other GPIOX_x ? Is it the same with some GPIOY_x ?

Share this post


Link to post
Share on other sites
16 hours ago, martinayotte said:

Did you try to see if same behavior happened with some other GPIOX_x ? Is it the same with some GPIOY_x ?

Not yet, sorry, had some other issues to solve first. I'm pretty sure that I adress X_5, as the connected load on that pin is being switched on and off.

I can try tomorrow with some pins from X and Y, my PCB layout has some limitations on that.

 

Update: I could test some more pins.

X_0 (470) works

X_1 (471) works

X_2 (472) works

X_3 (473) works

X_4 (474) works

X_5 (475) fails after setting "out"

X_6 (476) works

X_7 (477) works

X_8 (478) works

X_9 (479) works

X_10 (480) fails after setting "out"

X_11 (481) works

X_19 (489) works

X_21 (491) UNKNOWN (fixed 1Wire slave attached)

Y_3 (456) works

Y_7 (460) works

Y_8 (461) works

Y_13 (466) works

Y_14 (461) UNKNOWN (switches off Odroid Vcc :) )

 

Double checked on second C2, results are consistent.
 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
0