AnsweredAssumed Answered

problem with ADSP-BF561 EZ-KIT Lite and ADV7179

Question asked by weisl on Nov 22, 2011
Latest reply on Feb 16, 2012 by Nabeel

Hi,

I have a problem with the ADSP-BF561 EZ-KIT Lite and the ADV7179. First, some words about my hardware-configuration and program flow. I use the  ADSP-BF561 EZ-KIT Lite with the A-V EZ-Extender and the MT9V024 sensor head board. The sensor head board works well with the extender and the EZ-Lite. I get Frames over PPI0 into L3. Then follows some image processing. After this, I want to display the frame on TV. Depending on the duration of image processing and the NTSC frame rate, there exist two cases for me:

 

  1. ADV7179 has displayed one frame on TV and the image processing was completed. In this case, a new image should be displayed.

  2. ADV7179 has displayed out one frame on TV and the image is still under processing. In this case, the same image will be displayed as long as until the image processing is completed.

     

So the order of frames is not fixed and I can not use the ADI_DEV_MODE_CHAINED_LOOPBACK as data flow method. In my case I decided to use ADI_DEV_MODE_CHAINED as data flow method.

 

Her is some source code:

 

//buffers for output:

 

for (i = 0; i < NUM_OUT_BUFFERS; i++) {

OutboundBuffers[i].Data                        = NtscFrames[i];

OutboundBuffers[i].ElementWidth                = 4;

OutboundBuffers[i].XCount                      = (ADI_ITU656_NTSC_LINE_WIDTH/4);

OutboundBuffers[i].YCount                      = ADI_ITU656_NTSC_HEIGHT;

OutboundBuffers[i].XModify                     = 4;

OutboundBuffers[i].YModify                     = 4;

OutboundBuffers[i].CallbackParameter      = &OutboundBuffers[i];

OutboundBuffers[i].pNext                       = NULL;

}

 

 

//set up the ADV7179:

 

 

adi_twi_bit_rate rate = { 100, 50 };

adi_twi_pseudo_port pseudo = { ADI_FLAG_PF0, ADI_FLAG_PF1, ADI_TMR_GP_TIMER_2, (ADI_INT_PERIPHERAL_ID) NULL };

 

 

ADI_DEV_CMD_VALUE_PAIR TWIConfig [ ] = {

{ ADI_TWI_CMD_SET_PSEUDO,                     (void *)(&pseudo)                          },

{ ADI_DEV_CMD_SET_DATAFLOW_METHOD,           (void *)ADI_DEV_MODE_SEQ_CHAINED     },

{ ADI_TWI_CMD_SET_FIFO,                     (void *)0x0000                               },

{ ADI_TWI_CMD_SET_RATE,                     (void *)(&rate)                          },

{ ADI_TWI_CMD_SET_LOSTARB,                     (void *)1                                    },

{ ADI_TWI_CMD_SET_ANAK,                     (void *)0                                    },

{ ADI_TWI_CMD_SET_DNAK,                     (void *)0                                    },

{ ADI_DEV_CMD_SET_DATAFLOW,                (void *)TRUE                               },

{ ADI_DEV_CMD_END, NULL }

};

 

 

ADI_DEV_ACCESS_REGISTER Cfg_Regs_NTSC[ ] = {

 

{ADV717x_MR0, 0x00},

{ADV717x_MR1, 0x58},

{ADV717x_MR2, 0x00},

{ADV717x_MR3, 0x00},

{ADV717x_MR4, 0x10},

{ADV717x_TMR0, 0x00},

{ADV717x_TMR1, 0x00},

{ADI_DEV_REGEND, 0 }

};

 

 

ADI_DEV_CMD_VALUE_PAIR ConfigNTSCI[]={

{ADI_ADV717x_CMD_SET_TWI_CONFIG_TABLE,     (void *)TWIConfig                              },

{ADI_ADV717x_CMD_SET_PPI_DEVICE_NUMBER,     (void *)ENCODER_PPI                              },

{ADI_ADV717x_CMD_SET_PPI_STATUS,          (void *)ADI_ADV717x_PPI_OPEN               },

{ADI_ADV717x_CMD_SET_TWI_DEVICE_ADDRESS,(void *)0x2A                                   },

{ADI_DEV_CMD_SET_DATAFLOW_METHOD,          (void*)ADI_DEV_MODE_CHAINED     },

{ADI_ADV717x_CMD_SET_SCF_REG,               (void*)ADV717x_SCF_VALUE_NTSC               },

{ADI_DEV_CMD_REGISTER_TABLE_WRITE,          (void *)&Cfg_Regs_NTSC[0]                    },

{ADI_PPI_CMD_SET_LINES_PER_FRAME_REG,   (void *)ADI_ITU656_NTSC_HEIGHT               },

{ADI_PPI_CMD_SET_CONTROL_REG,               (void *)0x0182                             },

{ADI_PPI_CMD_SET_PACK_ENABLE,          (void *)TRUE                             },

{ADI_PPI_CMD_SET_DATA_LENGTH,          (void *)0x0                             },

{ADI_DEV_CMD_SET_STREAMING,             (void *)FALSE                           },

{ADI_DEV_CMD_END,NULL}

};

 

 

 

adi_dev_Open(DeviceManagerHandle, &ADIADV7179EntryPoint, 0, ENCODER_CLIENT_HANDLE7179, &ADV717xDriverHandle, ADI_DEV_DIRECTION_OUTBOUND, DMAManagerHandle, NULL, Callback);

 

 

adi_dev_Control(ADV717xDriverHandle,ADI_DEV_CMD_TABLE,(void*)Cfg_Regs_NTSC);

 

 

adi_dev_Write(ADV717xDriverHandle, ADI_DEV_2D, (ADI_DEV_BUFFER *)OutboundBuffers);

 

 

//Interrupt:

 

void Callback(void *AppHandle, u32  Event, void *pArg)

{

 

switch (Event) {

case ADI_DEV_EVENT_BUFFER_PROCESSED:

 

if (AppHandle == MT9V024_CLIENT_HANDLE)

{

 

           adi_dev_Control(InboundHandle, ADI_DEV_CMD_SET_DATAFLOW, (void *)FALSE);

           InboundFrameCounter = ( InboundFrameCounter + 1 ) % 2;

}

 

               if (AppHandle == ENCODER_CLIENT_HANDLE7179)

               {

if ( (State == IdleState) )

{

 

OldOutboundFrameCounter = OutboundFrameCounter;

OutboundFrameCounter = ( OutboundFrameCounter + 1 ) % 2;

 

adi_dev_Write(ADV717xDriverHandle, ADI_DEV_2D, (ADI_DEV_BUFFER*) &OutboundBuffers[OutboundFrameCounter]);

 

adi_dev_Read(InboundHandle, ADI_DEV_2D, (ADI_DEV_BUFFER *)&InboundBuffers[OldInboundFrameCounter]);

adi_dev_Control(InboundHandle, ADI_DEV_CMD_SET_DATAFLOW, (void *)TRUE);

 

OldInboundFrameCounter  = ( InboundFrameCounter + 1 ) % 2;

State = ProcessFrame;

 

}

 

else

{

adi_dev_Write(ADV717xDriverHandle, ADI_DEV_2D, (ADI_DEV_BUFFER                     *)&OutboundBuffers[OutboundFrameCounter]);

}

 

}

break;

default:

ezTurnOnAllLEDs();

}

}

 

 

 

Depending on this settings, I have a problem with the sync between two NTSC-frames. After each second field of a NTSC-frame there happens something strange. There are signals that should not be there. In the appendix are some pictures, which show what I mean. I have marked the strange signals in red.

 

In ADI_DEV_MODE_CHAINED_LOOPBACK with streaming it works well, but this is not a solution for me. Because I want to decide after each frame displayed, whether the same frame to be displayed again or wether a new frame to be displayed.

 

Maybe the ADV7179 works only in ADI_DEV_MODE_CHAINED_LOOPBACK mode?

 

 

Regards,

Stefan

Attachments

Outcomes