natbett
Posts: 6
Joined: Mon Feb 18, 2013 9:42 pm

i2c only works when HDMI is plugged in?

Mon Mar 11, 2013 8:38 pm

I am baffled by this. I cannot communicate with anything on i2c nor do the devices show up in i2cdetect -y 1 when the HDMI cable is not plugged in. I have a 20x4 i2c lcd screen that is powered through an Arduino and has the SDA and SCL pins connected to the Raspberry Pi. When the HDMI cable is plugged in everything works as expected. Doing an lsmod lists the same modules under both conditions. If I boot it without the HDMI cable plugged in it won't work until I plug the HDMI cable back in, no reboot required.

Doing a dmesg doesn't show anything changing when I plug and unplug the HDMI, neither does the syslog. I am using the power adapter that came with the kit from MCM, the only other thing plugged into it is an ethernet cable. I'm running raspbian and just upgraded it last week through apt.

Anyone have any ideas for what could be causing this?

User avatar
joan
Posts: 14936
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: i2c only works when HDMI is plugged in?

Mon Mar 11, 2013 8:41 pm

No idea.

Does the HDMI cable have to be active, i.e. connected to a monitor?

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 13100
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: i2c only works when HDMI is plugged in?

Mon Mar 11, 2013 8:51 pm

try grounding the PI, the PI doesn't have any connection to earth, except through the GND line of the HDMI connector. 50Hz signals from mains may leak through your PSU to the PI, causing problems like these.

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 5623
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: i2c only works when HDMI is plugged in?

Mon Mar 11, 2013 9:08 pm

This may be a "red-herring", but I wonder if it's related to the HDMI "hot plug detection" issue I've noted/logged in the wiki (http://elinux.org/R-Pi_Troubleshooting# ... put_at_all). It so happens that the (other) common factor is that the two Pi's in question (one a B2, the other an A) have i2c enabled (I'm playing around with a "Slice of PI/O" board and some LED displays). Trev.
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, 2xB2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B+, P3B, B+, and a A+) but Buster on the P4B's. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

natbett
Posts: 6
Joined: Mon Feb 18, 2013 9:42 pm

Re: i2c only works when HDMI is plugged in?

Mon Mar 11, 2013 9:42 pm

If I touch the cable to the HDMI housing it starts working. So that would point to this being a grounding issue correct? I just tried plugging the LCD directly into the pi for power (instead of being powered by the arduino) and it worked. Plugging something into the 5v pin on the pi still has the potential to burn out/short out the pi, right? Any other recommendations for this or a nicer way to ground this out?

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 5623
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: i2c only works when HDMI is plugged in?

Mon Mar 11, 2013 9:55 pm

natbett wrote: ...
I have a 20x4 i2c lcd screen that is powered through an Arduino and has the SDA and SCL pins connected to the Raspberry Pi.
...
Do you have a ground connection between the Pi and the LCD screen/Arduino?
(Silly question maybe, but sometimes we miss the obvious. Many years ago I had a screening/grounding issue with a piece of kit failing to work because "some kind person" had beautifully anodised the baseplate and grounding screws - I.E. no ground/common connection :? )
Trev.
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, 2xB2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B+, P3B, B+, and a A+) but Buster on the P4B's. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

natbett
Posts: 6
Joined: Mon Feb 18, 2013 9:42 pm

Re: i2c only works when HDMI is plugged in?

Mon Mar 11, 2013 11:32 pm

No, I don't have a ground between the two. I didn't even think of that. Can you explain why this is needed?

User avatar
joan
Posts: 14936
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: i2c only works when HDMI is plugged in?

Mon Mar 11, 2013 11:54 pm

natbett wrote:No, I don't have a ground between the two. I didn't even think of that. Can you explain why this is needed?
Electricity needs a circuit to flow.

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 13100
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: i2c only works when HDMI is plugged in?

Tue Mar 12, 2013 12:11 am

natbett wrote:No, I don't have a ground between the two. I didn't even think of that. Can you explain why this is needed?
you always need a ground return if you galvanically (that is when you rely on electricity for the connection) couple two circuits, so yes this is the problem!

as Joan wrote, electricity always runs in a circle! if you don't provide the ground to close the circle the electricity has nowhere to flow back through.

Its a consequence of one of "Kirchhoff's circuit laws" that current always runs in circles, look it up in wikipedia.

drgeoff
Posts: 10765
Joined: Wed Jan 25, 2012 6:39 pm

Re: i2c only works when HDMI is plugged in?

Tue Mar 12, 2013 1:09 am

natbett wrote:No, I don't have a ground between the two. I didn't even think of that. Can you explain why this is needed?
Did you never wonder why you've never seen a battery with only one contact? :)

natbett
Posts: 6
Joined: Mon Feb 18, 2013 9:42 pm

Re: i2c only works when HDMI is plugged in?

Tue Mar 12, 2013 6:20 pm

Ok, can I connect the ground on the arduino to the ground pin on the pi? It is still considered a bad idea to run something off the 5v pin on the pi, right?

obcd
Posts: 917
Joined: Sun Jul 29, 2012 9:06 pm

Re: i2c only works when HDMI is plugged in?

Tue Mar 12, 2013 6:26 pm

Yes and yes.

The grounds should be connected to each other and you should never connect a 5V io signal to a Pi GPIO pin. If the Pi gpio is used as input, then a bat85 diode can prevent the 5V from the arduino to reach the Pi pin. If the pin is pulled to ground, the diode will conduct. Make sure you mount it in the correct direction. A resistor in serie with the gpio pin can also serve as a current limiting protection. (Something like 1K)

natbett
Posts: 6
Joined: Mon Feb 18, 2013 9:42 pm

Re: i2c only works when HDMI is plugged in?

Tue Mar 12, 2013 6:38 pm

So, using the 5v pin to power the LCD should be fine as long as I put a resistor between the LCD and the ground?

User avatar
joan
Posts: 14936
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: i2c only works when HDMI is plugged in?

Tue Mar 12, 2013 6:44 pm

It's fine powering the LCD from 5V if it requires 5V. If it is a HD44780 compatible device you must ensure that the LCD pin 5 (R/W) is connected to ground so it doesn't feed 5V back to the Pi.

LCD pin 1 should be connected to ground on the Pi and Arduino. No resistor needed (at least, I never use one).

obcd
Posts: 917
Joined: Sun Jul 29, 2012 9:06 pm

Re: i2c only works when HDMI is plugged in?

Tue Mar 12, 2013 9:31 pm

I2C is tricky as the SDA line is output at one moment and input at another. You can buy prebuild bidirectional level shifters to interface a 5V IIC device to a 3V3 IIC master like the Pi.
If you power an LCD from the Pi GPIO 5V line, make sure it isn't using 2 much current.
If the Pi is powered from the micro usb plug, the LCD current passes trough the Pi polyfuse as well.
The LCD might not consume very much, but some backlights can consume several milliamps.
You should never place a resistor between 2 GND signals. They are suposed to carry the same voltage.

Return to “Troubleshooting”