Timing Regeneration Example with Selective Signals Overridden - 6.2 English

Video Timing Controller Product Guide (PG016)

Document ID
PG016
Release Date
2023-11-03
Version
6.2 English

Table: Example Horizontal Detection Register Outputs shows the detection register values for the source video timing in This Figure . Programming the horizontal generation registers to the values shown in Table: Example Horizontal Generation Register Inputs will result in the video timing signal outputs shown in This Figure .

Table 3-5: Example Horizontal Detection Register Outputs

Register Address

Register Name

Value

0x0020

Detector Active Size

0x0004_0003

0x0030

Detector HSize

0x0000_0007

0x0038

Detector HSync

0x0005_0004

0x0028

Detector Encoding

0x0000_0000

0x002C

Detector Polarity

0x0000_003f

Notice that all polarities bits are High in the Detection Polarity Register, signifying that all inputs are detected to have an active-High polarity.

Table 3-6: Example Horizontal Generation Register Inputs

Register Add Example Horizontal Generation Register Inputs

Register Name

Value

0x0060

Generator Active Size

0x0004_0001

0x0070

Generator HSize

0x0000_0007

0x0078

Generator HSync

0x0004_0003

0x0068

Generator Encoding

0x0000_0000

0x006C

Generator Polarity

0x0000_0037

0x0000

Control

0x0080_062f

Notice, in the Control Register, that bit 2 is set to enable generation, bit 3 is set to enable detection and bit 5 is set to enable synchronizing the generated output to the detected inputs.

The Horizontal Size ( ACTIVE_HSIZE_SRC ) Source Select (bit 9 of the Control Register) is set to 1. All other source selects are Low, signifying that all other detection registers should be used.

Also notice that the polarity of the output horizontal synchronization has been changed to active-Low by clearing bit 3 of the Generator Polarity Register.

Figure 3-7: Detected and Regenerated Horizontal Timing

X-Ref Target - Figure 3-7

Figure_9_Detected_and_Regenerated_Horizontal_Timing.png

IMPORTANT: All generated outputs remain synchronized to the inputs. The only changes made to the output are to the horizontal synchronization polarity and to the active video start and stop times.

The following C code shows how to configure the register values in Table: Example Horizontal Generation Register Inputs using the Video Timing Controller driver.

XVtc Vtc;                      /* Device driver instance */

XVtc_Signal SignalCfg;         /* VTC Signal configuration */

XVtc_Polarity Polarity;        /* Polarity configuration */

XVtc_SourceSelect SourceSelect;/* Source Selection configuration */

XVtc_Config *VtcCfgPtr;

VtcCfgPtr = XVtc_LookupConfig(VTC_DEVICE_ID);

XVtc_CfgInitialize(&Vtc, VtcCfgPtr, VtcCfgPtr->BaseAddress);

/* Setup the VTC Source Select config structure. */

/* 1=Generator registers are source */

/* 0=Detector  registers are source */

memset((void *)&SourceSelect, 0, sizeof(SourceSelect));

SourceSelect.VBlankPolSrc      = 0;

SourceSelect.VSyncPolSrc       = 0;

SourceSelect.HBlankPolSrc      = 0;

SourceSelect.HSyncPolSrc       = 1;

SourceSelect.ActiveVideoPolSrc = 0;

SourceSelect.ActiveChromaPolSrc= 0;

SourceSelect.VChromaSrc     = 0;

SourceSelect.VActiveSrc     = 1;

SourceSelect.VBackPorchSrc  = 0;

SourceSelect.VSyncSrc       = 0;

SourceSelect.VFrontPorchSrc = 0;

SourceSelect.VTotalSrc      = 0;

SourceSelect.HActiveSrc     = 0;

SourceSelect.HBackPorchSrc  = 0;

SourceSelect.HSyncSrc       = 0;

SourceSelect.HFrontPorchSrc = 0;

SourceSelect.HTotalSrc      = 0;

/* Setup the VTC Polarity config structure. */

memset((void *)&Polarity, 0, sizeof(Polarity));

Polarity.ActiveChromaPol = 1;

Polarity.ActiveVideoPol  = 1;

Polarity.VBlankPol       = 1;

Polarity.VSyncPol        = 1;

Polarity.HBlankPol       = 1;

Polarity.HSyncPol        = 0;

/* Setup the VTC Signal config structure. */

memset((void *)&SignalCfg, 0, sizeof(XVtc_Signal));

SignalCfg.OriginMode        = 1;//Set Frame Origin to Start of Active Video

SignalCfg.HTotal            = 7;

SignalCfg.HActiveStart      = 0;

SignalCfg.HFrontPorchStart  = 1;// Active Video Width

SignalCfg.HSyncStart        = 3;// Active Video Width + FP Width

SignalCfg.HBackPorchStart   = 4;// Active Video Width + FP Width + Sync Width

SignalCfg.V0Total           = 8;

SignalCfg.V0ChromaStart     = 0;

SignalCfg.V0ActiveStart     = 0;

SignalCfg.V0FrontPorchStart = 4;// Active Video Height

SignalCfg.V0SyncStart       = 5;// Active Video Height + FP_Width

SignalCfg.V0BackPorchStart  = 6;// Active Video Height + FP Width + Sync Width

/* Write VTC config to HW */

XVtc_RegUpdate(&VTC);

XVtc_SetPolarity(&Vtc, &Polarity);

XVtc_SetGenerator(&Vtc, &SignalCfg);

XVtc_SetSource(&Vtc, &SourceSelect);

XVtc_EnableSync&Vtc);// Synchronize the Generator to the Detector

/* Enable VTC Generator and Detector*/

XVtc_Enable(&Vtc);