HDMI CEC interface

Hi Mike,

thanks for the tip with the diode, I already had a diode on the pull up, but adding a second one did the trick quite well.

The minimum voltage of 2V in high state isn't a problem at all. The CEC bus is idle on high and active on low, This means that every device on the bus (including our own circuit) is pulling the bus high with a 27kOhm resistor while receiving/waiting for a transmission.

So if your circuit is pulling the CEC hight state to something > 3V the "logical 1 voltage" will always be equal or above this voltage, since every other pull up should be secured by a diode (ok not counting the leakage through the input pins, but this should be minimal). There is nobody really outputting a "logical 1 voltage", just all the pull up resistors resistors are bringing back the wire to high state. That's the reason why a transition of low to high can take up to 5 times longer than a transition of high to low and only on high to low a negative overshoot of 300mV is allowed.

For transmission all you have to do is turning your pull up off and pulling the wire down to 0V while being prepared that a current of max 3.6V/(27kOhm/10)=~1.3mA is flowing through your pull down.

Did I get it right or is there anything wrong in my thoughts?
When I think about it now, could I underestimate the leakage of the other input circuits? The input leakage of the MSP430 is something about 5nA, measured when connecting 3V to the pin, and I expect other devices to have about the same.

Anyway on the MSP430 you won't have this problem at all, according to the documentation everything above 1.35V is considered as high and everything below 0.75V as low.

Regards,
Christian.

I created a working HDMI-CEC shield in Eagle CAD.

Not the best etch in history, but it works! I added connections to the DDI i2c bus for use with Wire.h, though I have not tested it. There is also a pin connected to the hotplug wire, which again I have not yet tested.

Here is the PDF I used for the transfer:
http://www.andrewncarr.com/hdmi/hdmi-cec-shield4.pdf

Here are the Eagle files:
http://www.andrewncarr.com/hdmi/hdmi-cec-shield-eagle-files.zip

One of the things I did was remove all the pins left of the CEC pin, so I had less bridging to worry about. Feedback is welcome, I am by no means any kind of expert on PCB layout.

Hi everybody
I was playing with RainShadow CEC bridge for a few weeks before I've discovered this thread. I have HTPC, Panasonic TV and CEC bridge and the goal is to control HTPC playback with tv remote. I can successfully control TV (switch on/off, etc) via CEC, but could not transfer any tv-rc controls via bus. So far my best "handshake" with TV is below:

Packet received: 0 -> 4
83
Packet received: 4 -> 15
84 30 00 04
Packet received: 0 -> 4
8C
Packet received: 4 -> 15
87 00 80 45
Packet received: 0 -> 4
89 10 01 03
Packet received: 4 -> 0
00 89 03
Packet received: 0 -> 4
A0 00 80 45 06 03
Packet received: 4 -> 0
00 A0 04
Packet received: 0 -> 15
80 00 00 10 00
Packet received: 0 -> 15
86 10 00

Is there anything unusual here? Am I doing something wrong? I would be glad to get any hints.
Thanks in advance for help!

If i decode it correctly, the packet sequence you send looks something like this:

len:2 src:0x0 dst:0x4 opcode: 0x83 (Give Physical Address)
len:5 src:0x4 dst:0xF opcode: 0x84 (Report Physical Address) addr:3.0.0.0 device type:Playback Device
len:2 src:0x0 dst:0x4 opcode: 0x8C (Give Device Vendor ID)
len:5 src:0x4 dst:0xF opcode: 0x87 (Device Vendor ID)
len:5 src:0x0 dst:0x4 opcode: 0x89 (Vendor Command)
len:4 src:0x4 dst:0x0 opcode: 0x00 (Feature Abort) feature-opcode: 0x89 (Vendor Command)
len:7 src:0x0 dst:0x4 opcode: 0xA0 (Vendor Command With ID)
len:4 src:0x4 dst:0x0 opcode: 0x00 (Feature Abort) feature-opcode: 0xA0 (Vendor Command With ID)
len:6 src:0x0 dst:0xF opcode: 0x80 (Routing Change) original:0.0.0.0 new:1.0.0.0
len:4 src:0x0 dst:0xF opcode: 0x86 (Set Stream Path) addr:1.0.0.0

Beside from the adress exchange it looks like that your TV asks you what kind of vendor you are. You report that you have vendor id 10 01 03 (whatever this is). Then the TV requests that you execute a vendor specific command, which is reqjected by you. Then the TV requests to execute a vendor specific command with a vendor id, which is again rejected by you.

I would try to send a [“Activated”] message to the TV instead.

Regards,
Christian.

10 01 03 is related to vendor-specific command, not "Device Vendor ID", which was Panasonic (00 80 45)
Rejection of vendor-specific commands I've taken from the log on previous page (5), which happens between real Panasonic receiver and TV.
Will try Menu Status "Activated" command anyway - thanks :slight_smile:

I've got working code to read the physical address from EDID, just need to clean it up, and I'll post it.

Started a vendor capability chart on the googlecode wiki, so we can share info on what vendors/models can do what.

Chirstian, According to HDMI specs [Activate] looks exactly what I need, but I've tried:
Packet received: 4 -> 0
8E 01

And it does not pass any rc command to hdmi bus.
Any ideas what I'm doing wrong?

Ghuron:
Are you trying to send commands to the tv, or are you expecting the tv to send commands to your device?

What is the model of your panasonic?

I'm trying to send it to the tv (->0), which is Panasonic TH-R42PY8

If [Activated] isn't replied with a then all you have todo is convince the TV that you are the active source.

Try the following sequence:

  1. Do the address algo stuff, at least send an with your connector address, so the TV can make a mapping between connector<->cec address.

  2. Send to switch the TV to your input connector.

  3. Send or to confirm that you are the displaying device.

  4. Send [Activated] to tell the TV that you are ready to receive Button Commands.

Reset link, TV queries logical addresses from 01 to 0E, only 04 responds. After that:

Packet received: 0 -> 4
83
Packet received: 4 -> 15
84 30 00 04
Packet received: 0 -> 4
8C
Packet received: 4 -> 15
87 00 80 45
Packet received: 0 -> 4
89 10 01 03
Packet received: 4 -> 0
00 89 03
Packet received: 0 -> 4
A0 00 80 45 06 03
Packet received: 4 -> 0
00 A0 04
Packet received: 0 -> 15
80 00 00 10 00
Packet received: 0 -> 15
86 10 00
Packet received: 4 -> 15
82 30 00
Packet received: 4 -> 0
04
Packet received: 4 -> 0
0D
Packet received: 4 -> 0
8E 01

I'm clicking arrow menu buttons, can see that led green light on TV is blinking (so the command is received), but nothing is transferred via cec line.

My understanding is that I've responded to all of the requests correctly. Moreover, I'm sure device works ok, because I can switch TV on issuing '04' command.
Maybe the problem is that I'm using my own piece of code, written in C#. Do you guys have kind of standard module, that can communicate to CEC devices?

I'm working on a C++ object to sit atop what Phil has done, to initially provide a basic set of responses to other devices. Nothing usable yet. I'd like to have some standard based communication mechanism between this object and code running on the PC, so the arduino could hold some basic state (like display name, what is supported...) and pass along other things for the PC side to handle.

I'd be interested in seeing what you've got in C# if you want to post a link.

Any opinions on the format for sending and receiving packet data and settings between the arduino and pc? There is the option of sending the bytes binary, with a small header, or something text based like the RainShadow device.

I'm using a very simple binary interface.

1 byte for the length of the packet, followed by the packet data.
Special events are transmitted with the msb of the length byte set:
0x01-0x0F Length of the following packet
0xF0 Transmission suceeded
0xF1 NAK received while Transmitting
0xF2 Arbitation lost.
etc..

Just before Christmas I got the idea to use CEC for HTPC control. A few weeks ago I discovered this topic which I think is very elegant. I ordered an Arduino Duemilanove which was delivered last week and currently I am collecting the components required for the interfacing.

In order to avoid the HDMI header soldering I plan to cut an HDMI cable and wire it directly to a breadboard for now. Do you guys expect any problems with such a setup?

Hi mervel,

I'm using such a cable. You don't need to cut the cable in two halfs, just open the cable with caution and attach your cable to the needed wires. These wires for GND, CEC, Hotplug detect, I2C, etc. are non-shielded wires in opposite to the TDMS links, so you can easily identify them.

#Edit
Here the colors from my cable, yours may be different:

Pin no. color Signal
13 red CEC
15 orange SCL
17 grey GND
19 pink Hot Plug Detect
14 white reserved
16 yellow SDA
18 blue +5V

Here another cable: http://www.solidcable.com/siyousyo/3031.pdf

MikeT

Today the parts arrived. I built the circuit on a breadboard according to Mike T's schematics. I noticed that Andres uses 3 additional resistors with his etch. Is there any reason for that?

I removed the shield of one side of the HDMI cable. Currently no soldering iron available so I cannot make the connections inside the cable. According to the schematics by Mike T, only the CEC pin and DDC/CEC ground pins are connected. So I can leave all other wires?

My etch has connections for the i2c pins as well as the hotplug and 5v pins. Those are not required, the CEC part of the etch is based on MikeT's design. I actually plan to update my design to allow the 5v pin to be turned off, as it makes the hdmi port appear "active" on my Samsung tv. Just haven't had any time for this project recently. I do have working code that reads and parses the EDID frames to determine the port ID, if anyone is interested I can post it.

I placed all components on a breadboard according the scheme. Connected the I/O pins with my Arduino. Now the only two connections to be made are the CEC en CEC ground wires (long yellow and green wires leaving the right side of the picture below). Currently waiting for a decent soldering station to connect the two wires to a cracked HDMI connector.

/me hopes his Sony TV will survive the project :smiley:

  • mervel hopes his Sony TV will survive the project

One of the nice aspects of the HDMI spec is that compliant devices are required to tolerate shorts on any wire, so in theory you have some reasonable assurance that you probably wont destroy your TV with this project... maybe. :wink: