已回答假定已回答

ADV7511 HDMI no video output

Corsair 在 2018-1-12 詢問的問題
最後回覆由EmmaChen於2018-1-15提供

We can light on LCD monitor by ADV7511, but the video from Sensor module can not displayed, only blue screen.

Connection:

Video sensor=>Serdes=>ADV7511=>LCD

The input type is YUV422, 1280*800 8 bits @30 FPS CB Y CR Y, HSYNC and VSYNC separated, no DE input, use ADV7511 generate DE.

source.png

Detail setting:

/*============================================================================

* Read up to 8-bit field from a single 8-bit register

* ________  

* Example     |___***__|  Mask = 0x1C     BitPos = 2

*

*

* Entry:  

* RegAddr = 8-bit register address

* Mask    = Field mask

* BitPos  = Field LSBit position in the register (0-7)

*

* Return:  Field value in the LSBits of the return value

*

*===========================================================================*/

unsigned char ATV_I2CReadField8(unsigned char RegAddr, unsigned char Mask,unsigned char BitPos)

{

       unsigned char ReadValue;

       ReadValue = HDMIRegisterRead(HDMI_CHIP_ADV7511, RegAddr);

       ReadValue = ReadValue & Mask;

       ReadValue =  ReadValue >> BitPos;

       return ReadValue;

}

/*============================================================================

* Write up to 8-bit field to a single 8-bit register

* ________  

* Example     |___****_|  Mask = 0x1E     BitPos = 1

*

* Entry:  

* RegAddr = 8-bit register address

* Mask    = Field mask

* BitPos  = Field LSBit position in the register (0-7)

* Set to 0 if FieldVal is in correct position of the reg

*          FieldVal= Value (in the LSBits) of the field to be written

* If FieldVal is already in the correct position (i.e.,

* does not need to be shifted,) set BitPos to 0

*

* Return:  None

*

*===========================================================================*/

void ATV_I2CWriteField8 (unsigned char RegAddr, unsigned char Mask, unsigned char BitPos, unsigned char FieldVal)

{

       unsigned char ReadValue;

       unsigned char WriteValue;

       ReadValue = HDMIRegisterRead(HDMI_CHIP_ADV7511, RegAddr);

       ReadValue = ReadValue & (~Mask);

       WriteValue = ReadValue + (FieldVal << BitPos);

HDMIRegisterWrite(HDMI_CHIP_ADV7511, RegAddr, WriteValue);

}

void Initial_HDMI_chip()

{

      

       unsigned char ReadValue;

       unsigned char REG_FB, REG_35, REG_36, REG_37, REG_38, REG_39, REG_3a;

      

ReadValue = HDMIRegisterRead(HDMI_CHIP_ADV7511, 0x41);

ReadValue = ReadValue & 0xbf;

HDMIRegisterWrite(HDMI_CHIP_ADV7511, 0x41, ReadValue);

HDMIRegisterWrite(HDMI_CHIP_ADV7511, 0x98, 0x03);

ReadValue = HDMIRegisterRead(HDMI_CHIP_ADV7511, 0x9a);

ReadValue = ReadValue | 0xe0;

HDMIRegisterWrite(HDMI_CHIP_ADV7511, 0x9a, ReadValue);

HDMIRegisterWrite(HDMI_CHIP_ADV7511, 0x9c, 0x30);

ReadValue = HDMIRegisterRead(HDMI_CHIP_ADV7511, 0x9d);

ReadValue = ReadValue & 0xfc;

ReadValue = ReadValue | 0x01;

HDMIRegisterWrite(HDMI_CHIP_ADV7511, 0x9d, ReadValue);

HDMIRegisterWrite(HDMI_CHIP_ADV7511, 0xa2, 0xa4);

HDMIRegisterWrite(HDMI_CHIP_ADV7511, 0xa3, 0xa4);

HDMIRegisterWrite(HDMI_CHIP_ADV7511, 0xe0, 0xd0);

HDMIRegisterWrite(HDMI_CHIP_ADV7511, 0xf9, 0x00);

//video input setup

ReadValue = HDMIRegisterRead(HDMI_CHIP_ADV7511, 0x15);

ReadValue = ReadValue & 0xf0;   //YUV422

ReadValue = ReadValue | 0x03;   //YUV422

HDMIRegisterWrite(HDMI_CHIP_ADV7511, 0x15, ReadValue);

 

ReadValue = HDMIRegisterRead(HDMI_CHIP_ADV7511, 0x16);

ReadValue = ReadValue & 0xcf;   //8 bits

ReadValue = ReadValue | 0x30;   //8 bits

HDMIRegisterWrite(HDMI_CHIP_ADV7511, 0x16, ReadValue);

 

ReadValue = HDMIRegisterRead(HDMI_CHIP_ADV7511, 0x16);

ReadValue = ReadValue & 0xf3;   //input style 2

ReadValue = ReadValue | 0x04;   //

HDMIRegisterWrite(HDMI_CHIP_ADV7511, 0x16, ReadValue);

 

ReadValue = HDMIRegisterRead(HDMI_CHIP_ADV7511, 0x16);

ReadValue = ReadValue & 0xfe;   //input RGB=0, YUV=1

ReadValue = ReadValue | 0x01;   //

HDMIRegisterWrite(HDMI_CHIP_ADV7511, 0x16, ReadValue);

 

ReadValue = HDMIRegisterRead(HDMI_CHIP_ADV7511, 0x17);

ReadValue = ReadValue & 0xfd;   //input video aspect

ReadValue = ReadValue | 0x02;   //bit 1 4:3=0 16:9=1

HDMIRegisterWrite(HDMI_CHIP_ADV7511, 0x17, ReadValue);

 

ReadValue = HDMIRegisterRead(HDMI_CHIP_ADV7511, 0x48);

ReadValue = ReadValue & 0xe7;   //

ReadValue = ReadValue | 0x08;   //bit4:3 0x01 right just

//ReadValue = ReadValue & 0xbf;   //

//ReadValue = ReadValue | 0x40;   //bit6 LSB<=>MSB

HDMIRegisterWrite(HDMI_CHIP_ADV7511, 0x48, ReadValue);

 

ReadValue = HDMIRegisterRead(HDMI_CHIP_ADV7511, 0x41);

ReadValue = ReadValue & 0xfd;   //

//ReadValue = ReadValue | 0x02;   //bit1 adjust sync used for DE path select, no sync adjust

HDMIRegisterWrite(HDMI_CHIP_ADV7511, 0x41, ReadValue);

 

ReadValue = HDMIRegisterRead(HDMI_CHIP_ADV7511, 0xd0);

//ReadValue = ReadValue & 0xf3;   //

//ReadValue = ReadValue | 0x04;   //bit3:2 0x01 HSYNC

ReadValue = ReadValue & 0xfd;

ReadValue = ReadValue | 0x02;   //bit1 0x01 DE  //corsair

HDMIRegisterWrite(HDMI_CHIP_ADV7511, 0xd0, ReadValue);

 

//video output setup         

ReadValue = HDMIRegisterRead(HDMI_CHIP_ADV7511, 0x16);

ReadValue = ReadValue & 0x7f;   //YUV422

ReadValue = ReadValue | 0x80;   //YUV422

HDMIRegisterWrite(HDMI_CHIP_ADV7511, 0x16, ReadValue);

 

ReadValue = HDMIRegisterRead(HDMI_CHIP_ADV7511, 0x18);

ReadValue = ReadValue & 0x7f;   //CSC YUV=>RGB

//ReadValue = ReadValue | 0x80;   //

HDMIRegisterWrite(HDMI_CHIP_ADV7511, 0x18, ReadValue);

 

ReadValue = HDMIRegisterRead(HDMI_CHIP_ADV7511, 0x18);

ReadValue = ReadValue & 0x9f;   //scale

ReadValue = ReadValue | 0x00;   //1.0 -4096~4095

HDMIRegisterWrite(HDMI_CHIP_ADV7511, 0x18, ReadValue);

 

ReadValue = HDMIRegisterRead(HDMI_CHIP_ADV7511, 0xaf);

ReadValue = ReadValue & 0xfd;   //Manual HDMI or DVI

ReadValue = ReadValue | 0x02;   //1 HDMI 0 DVI

HDMIRegisterWrite(HDMI_CHIP_ADV7511, 0xaf, ReadValue);

 

ReadValue = HDMIRegisterRead(HDMI_CHIP_ADV7511, 0x40);

ReadValue = ReadValue & 0x7f;   //GC

//ReadValue = ReadValue | 0x80;   //1 GC enable 0 GC disable

HDMIRegisterWrite(HDMI_CHIP_ADV7511, 0x40, ReadValue);

 

 

ReadValue = HDMIRegisterRead(HDMI_CHIP_ADV7511, 0x4c);

ReadValue = ReadValue & 0xf0;   //GC

ReadValue = ReadValue | 0x00;   //GC CD

HDMIRegisterWrite(HDMI_CHIP_ADV7511, 0x4c, ReadValue);

 

//DE GEN          

HS_DELAY = 3;//start pixel  0xFB[7],0x35 and 0x36[7:6] minus one

VS_DELAY = 80;//start line 0xFB[6:5] and 0x36[5:0] is the number of Hsyncs

WIDTH = 1280;//0xFB[4],0x37[4:0] and 0x38[7:1] indicate the width

HEIGHT = 720;//0xFB[3],0x39 and 0x3A[7:4]

INTERLACE_NUMBER = 0;//0x37[7:5] defines the difference of Hsync counts during Vsync blanking for the two fields in interlaced video

 

REG_35 = 0; REG_36 = 0; REG_37 = 0; REG_38 = 0; REG_39 = 0; REG_3a = 0;

REG_37 = HDMIRegisterRead(HDMI_CHIP_ADV7511, 0x37);

REG_37 = REG_37 & 0x1f;

REG_37 = REG_37 | ((unsigned char)(((INTERLACE_NUMBER & 0x0007)<<5)&0xe0));

 

REG_FB = HDMIRegisterRead(HDMI_CHIP_ADV7511, 0xFB);

REG_FB = REG_FB | 0x06;//low refresh rate

REG_FB = REG_FB & 0x07;//get low 3 bits

 

if(HS_DELAY & 0x0400)//1111 1011 1111 1111

REG_FB = REG_FB | 0x80;

REG_35 = (unsigned char)(HS_DELAY >>2) & 0xff;

REG_36 = REG_36 | ((unsigned char)(((HS_DELAY & 0x0003)<<6)&0xc0));

 

REG_FB = REG_FB | ((unsigned char)(((VS_DELAY & 0x00c0)>>1)&0x60));

REG_36 = REG_36 | ((unsigned char)(VS_DELAY & 0x003f));

 

if(WIDTH & 0x1000)//1110 1111 1111 1111

REG_FB = REG_FB | 0x10;

REG_37 = REG_37 & 0xe0;

REG_37 = REG_37 | ((unsigned char)(((WIDTH & 0x0f80)>>7)&0x1f));

REG_38 = HDMIRegisterRead(HDMI_CHIP_ADV7511, 0x38);     

REG_38 = REG_38 & 0xfe;

REG_38 = REG_38 | ((unsigned char)(((WIDTH & 0x007f)<<1)&0xfe));

 

if(HEIGHT & 0x1000)//1110 1111 1111 1111

REG_FB = REG_FB | 0x08;  

REG_3a = HDMIRegisterRead(HDMI_CHIP_ADV7511, 0x3a);

REG_3a = REG_3a & 0x0f;

REG_39 = REG_39 | ((unsigned char)(((HEIGHT & 0x0ff0)>>4)&0xff));

REG_3a = REG_3a | ((unsigned char)(((HEIGHT & 0x000f)<<4)&0xf0));

 

HDMIRegisterWrite(HDMI_CHIP_ADV7511, 0x35, REG_35);

HDMIRegisterWrite(HDMI_CHIP_ADV7511, 0x36, REG_36);

HDMIRegisterWrite(HDMI_CHIP_ADV7511, 0x37, REG_37);

HDMIRegisterWrite(HDMI_CHIP_ADV7511, 0x38, REG_38);

HDMIRegisterWrite(HDMI_CHIP_ADV7511, 0x39, REG_39);

HDMIRegisterWrite(HDMI_CHIP_ADV7511, 0x3a, REG_3a);

HDMIRegisterWrite(HDMI_CHIP_ADV7511, 0xFB, REG_FB);

 

ReadValue = HDMIRegisterRead(HDMI_CHIP_ADV7511, 0x17);//internal DE GEN

ReadValue = ReadValue & 0xfe;  

ReadValue = ReadValue | 0x01;  

HDMIRegisterWrite(HDMI_CHIP_ADV7511, 0x17, ReadValue);//corsair

 

ATV_I2CWriteField8(0x17, 0x60, 0x5, 0);

 

//HDCP

ReadValue = HDMIRegisterRead(HDMI_CHIP_ADV7511, 0xaf);

ReadValue = ReadValue & 0x7f;   //GC

//ReadValue = ReadValue | 0x80;   //1 HDCP enable 0 HDCP disable

HDMIRegisterWrite(HDMI_CHIP_ADV7511, 0xaf, ReadValue);

 

HDMIRegisterWrite(HDMI_CHIP_ADV7511, 0x55, 0x20);//AVINFO

HDMIRegisterWrite(HDMI_CHIP_ADV7511, 0x56, 0x08);//AVINFO

 

 

}

結果