11-24-2017 01:14 PM - edited 11-24-2017 01:30 PM
Hi, I have problems working with the timing controller as detector. The IP core version is 6.1
For test I connected the generator timing output to the detector input. Configuration of the generator works. I confirmed the output signals.
I tested with the following code:
/* Run selftest example */
Status = XVtcSelfTestExample(VTC_DEVICE_ID);
/* Checking status */
if (Status != (XST_SUCCESS)) {
xil_printf("VTC Selftest Example Failed.\r\n");
return (XST_FAILURE);
}
xil_printf("Successfully ran VTC driver Selftest Example.\r\n");
/* 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=1;
SourceSelect.VSyncPolsrc=1;
SourceSelect.HBlankPolsrc=1;
SourceSelect.HSyncPolsrc=1;
SourceSelect.ActiveVideoPolsrc=1;
SourceSelect.ActiveChromaPolsrc=1;
SourceSelect.VChromasrc=1;
SourceSelect.VActivesrc=1;
SourceSelect.VBackPorchsrc=1;
SourceSelect.VSyncsrc=1;
SourceSelect.VFrontPorchsrc=1;
SourceSelect.VTotalsrc=1;
SourceSelect.HActivesrc=1;
SourceSelect.HBackPorchsrc=1;
SourceSelect.HSyncsrc=1;
SourceSelect.HFrontPorchsrc=1;
SourceSelect.HTotalsrc=1;
/* Setup the VTC Polarity config structure. */
memset((void *)&Polarity, 0, sizeof(Polarity));
Polarity.ActiveChromaPol = 1;
Polarity.ActiveVideoPol = 1;
Polarity.VBlankPol = 1;
Polarity.VSyncPol = 0;
Polarity.HBlankPol = 1;
Polarity.HSyncPol = 1;
/* 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 = 3;// Active Video Width
SignalCfg.HSyncStart = 4;// Active Video Width + FP Width
SignalCfg.HBackPorchStart = 5;// Active Video Width + FP Width + Sync Width
SignalCfg.V0Total = 7;
SignalCfg.V0ChromaStart = 0;
SignalCfg.V0ActiveStart = 0;
SignalCfg.V0FrontPorchStart = 3;// Active Video Height
SignalCfg.V0SyncStart = 4;// Active Video Height + FP_Width
SignalCfg.V0BackPorchStart = 5;// 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_DisableSync(&Vtc);// not Synchronize the Generator to the Detector
XVtc_RegUpdateEnable(&Vtc);
/* Enable VTC Generator and Detector*/
XVtc_Enable(&Vtc);
/* Setup the VTC Timing structure. */
memset((void *)&Timing, 0, sizeof(Timing));
memset((void *)&DetSignal, 0, sizeof(DetSignal));
memset((void *)&HoriOffsets, 0, sizeof(HoriOffsets));
memset((void *)&DetPolarity, 0, sizeof(DetPolarity));
while(1)
{
usleep(1000000);
XVtc_GetDetectorPolarity(&Vtc, &DetPolarity);
printStatus();
}
void printStatus()
{
if ((XVtc_GetDetectionStatus(&Vtc) & XVTC_STAT_LOCKED_MASK))
{
xil_printf("locked\n\r");
}else
xil_printf("not locked\n\r");
}
However, detector does never lock. Do I need to update the register somewhere or am I missing something?
many thanks
11-25-2017 04:26 AM
i am providing all signals needed for the detector operating.
i am following the configuration sequence, updating the configuration with 'XVtc_RegUpdate'
fsync_in is set to '0', the IP configured for 'disabled'
both generator and detector are enabled
is there a minimum pulse length required? i only have 1 clock domain
do I need to call 'XVtc_RegUpdate' before reading the status? I don't think so...
12-12-2017 06:39 AM
Hi @mod28,
You can use the xapp1295 as example. I uses the VTC as detector.
You should also try 2 different instances for detector and generator. I am not sure if detecting what is outputed from the same core works.
Let me know if that helps,
Best Regards,
Florent
12-12-2017 06:05 PM
Hi @mod28
Generally, video timing detector requires at least "DE (active video signal)".
In this case, Xilinx's VTC requires at least "hs, vs, active_video".
Also, you are paying the care to sync polarity, too.
Could you confirm them ?
Thank you.
Best regards,
12-13-2017 07:50 AM
thanks for your help. Yes, I am providing hs, vs and active video (as shown in picture).
There was a previous version on which using only 1 core as generator and detector would not work due to a bug. I am using the IP core version 6.1 so it should work.
Sync_in is set to '0' as stated in pg016. I set the polarity in Polarity config structure. I changed it occasionally with no luck.
Polarity should be detected by the core without further configuration.
@florentw, thanks for the link (I think you meant xapp1285) The link in the document for xapp1285.zip is no longer working. Couldn't find the sources.
12-13-2017 08:10 AM
Hi @mod28,
Please use this link to download the xapp1285 (link from DocNav).
Best Regards,
Florent
12-15-2017 06:26 AM
Hi @mod28,
Do you have any updates on this?
Best Regards,
Florent