Hi everybody,
I am working on a project that sends custom EDID information to a source device.
The device i’m using is the Chipkit Uc32 (based on Arduino Uno) http://www.digilentinc.com/Products/Detail.cfm?NavPath=2,892,1035&Prod=CHIPKIT-UC32
I’m using for both HDMI in and out a breakout board with all of the data lines connected thru and the SDA, SCL, 5V, GND and hotplug detection come from the Chipkit.
My code is very simple, i make use of the OnRequest() function to send the EDID data when the source reads on address 0x50.
#include <DTWI.h>
#include <Wire.h> //BUFFER_LENGTH = 256
uint8_t edid[256] = {
0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x4C, 0x2D, 0xF4, 0x0C, 0x45, 0x52, 0x46, 0x31, 0x15, 0x19, 0x01, 0x03, 0x80, 0x3C, 0x22, 0x78, 0x2A, 0x52, 0x95, 0xA5, 0x56, 0x54, 0x9D, 0x25, 0x0E, 0x50, 0x54, 0xBF, 0xEF, 0x80, 0x71, 0x4F, 0x81, 0xC0, 0x81, 0x00, 0x81, 0x80, 0x95, 0x00, 0xA9, 0xC0, 0xB3, 0x00, 0x01, 0x01, 0x02, 0x3A, 0x80, 0x18, 0x71, 0x38, 0x2D, 0x40, 0x58, 0x2C, 0x45, 0x00, 0x56, 0x50, 0x21, 0x00, 0x00, 0x1E, 0x01, 0x1D, 0x00, 0x72, 0x51, 0xD0, 0x1E, 0x20, 0x6E, 0x28, 0x55, 0x00, 0x56, 0x50, 0x21, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0xFD, 0x00, 0x32, 0x4B, 0x1E, 0x51, 0x11, 0x00, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x53, 0x32, 0x37, 0x45, 0x33, 0x37, 0x30, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x01, 0x62, 0x02, 0x03, 0x1B, 0xF1, 0x46, 0x90, 0x04, 0x1F, 0x13, 0x03, 0x12, 0x67, 0x03, 0x0C, 0x00, 0x10, 0x00, 0x80, 0x22, 0x23, 0x09, 0x07, 0x07, 0x83, 0x01, 0x00, 0x00, 0x01, 0x1D, 0x00, 0xBC, 0x52, 0xD0, 0x1E, 0x20, 0xB8, 0x28, 0x55, 0x40, 0x56, 0x50, 0x21, 0x00, 0x00, 0x1E, 0x8C, 0x0A, 0xD0, 0x90, 0x20, 0x40, 0x31, 0x20, 0x0C, 0x40, 0x55, 0x00, 0x56, 0x50, 0x21, 0x00, 0x00, 0x18, 0x8C, 0x0A, 0xD0, 0x8A, 0x20, 0xE0, 0x2D, 0x10, 0x10, 0x3E, 0x96, 0x00, 0x56, 0x50, 0x21, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3D
};
void receiveEvent(int receivedByte)
{
if (receivedByte == 1) //If there is 1 byte received
{
int receivedValue = Wire.read() << 1;
receivedValue |= Wire.read();
Serial.print("Read byte: ");
Serial.print(receivedValue);
Serial.println();
}
else
{
Serial.println("Not the amount of bytes that was expected: ");
Serial.print(receivedByte);
}
while(Wire.available())
{
Wire.read();
}
return;
}
void requestEvent()
{
Serial.println();
for (int i = 0; i < 256; i++){
Wire.write(edid[i]); //Write EDID
Serial.print(edid[i], HEX); //Print EDID
Serial.print(",");
}
Serial.println();
Serial.println("Finished"); //Write is complete
}
void setup()
{
Serial.begin(9600);
Serial.println("**** HDMI ****");
pinMode(2, OUTPUT); //Hot plug detection
Wire.begin(0x50);
digitalWrite(2, LOW);
delay(20);
digitalWrite(2, HIGH); //Source knows that a screen is attached and want to read the edid of the screen
Wire.onReceive(receiveEvent);
Wire.onRequest(requestEvent);
}
void loop()
{
}
Basically i trick the source into thinking that the screen attached has a resolution of 1080p. The purpose is that i can send any resolution.
The code works when i use my laptop, computer and blu-ray player as source, but when i use an other settopbox or another computer the screen stay’s dark and keeps searching for a source.
I attached the handshake of my settopbox, you see that the first block (00 FF FF…) is send and the extension block (02 03 1B…) it is send just fine but when i run my program it only sends the first 34 bytes.
Does anyone has an idea why it does work on some devices and some it wont work.