This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

DM355 EVM AUTOFOCUS EXAMPLE NOT WORKING

I test the evm's af test program using a step motor.The modified program is below.

/////////////////////////////////////////////////////////////////////////////////////////////////

pace=0x8140//start motor position

 while(pace<0x819d)
 {

  index=0;fv=0;
  result = read(fd,(void *)buffer_stat,buff_size);       
  if(result < 0)
  {
   printf("\n Read Failed");
  } 
  if(result  >0)
  {
   //printf("\nOutput is in file af_samp.txt");
   fprintf(fp1,"\npace=0x%x",pace);
   k11= ( int *)buffer_stat;
   for(count=0;count<buff_size/4;count++)
   { 
    fprintf(fp1,"\n%d",k11[count]);
   }
   
   fv=k11[2];//use green fv value
   fprintf(fp1,"\n%d",fv);
   if(fv>fvmax)
   {
    fvmax=fv;
    maxpace=pace;//record max fv value and step motor position
   }
   
  }
  else
  {
   printf("\n *** NOT ABLE TO READ*****");
  }

  //printf("\n NO OF BYTES READ %d",result);
  pace+=5;
  //set to start focus position
  setfocusposition(id232,pace);//step foward
  //wait until reach the position
  waitforreachsig(id232);//wait until motor stop
 }

/////////////////////////////////////////////////////////////////////////////////////////////

I can't get a peak position using the green FV value.My paxel configuration is below:

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////

struct af_configuration config;
 int  result = 0, index;
 int iir0[12] = { 64, 0, 0, 21, 22, 21, 0, 0, -16, 32, -16 };
 int iir1[12] = { 64, 0, 0, 21, 22, 21, 0, -29, -16, 32, -16 };

 /*Open AF driver */
 fd = open(DRIVER_NAME, O_RDWR);
 if (fd < 0) {
  printf("Error in opening AF Device\n");
  return;
 }
 /* Select input source as SDRAM */

 /* Enable Alaw */
 config.alaw_enable = H3A_AF_ENABLE; 
 /*Set Horizontal Median filter*/
 config.hmf_config.enable = H3A_AF_DISABLE;
 config.hmf_config.threshold = 100;
 /* Set paxel Parmateres */
 config.iir_config.hz_start_pos = 2;
 config.paxel_config.height = 32;
 config.paxel_config.width = 124 ;
 config.paxel_config.line_incr = 2;
 config.paxel_config.vt_start = 60;
 config.paxel_config.hz_start = 480;
 config.paxel_config.hz_cnt = 1;
 config.paxel_config.vt_cnt = 1;
 /* Set Accumulator mode */
 config.mode = ACCUMULATOR_SUMMED;
 //config.mode = ACCUMULATOR_PEAK;
 /* Set IIR Filter Parameters */
 for (index = 0; index < 11; index++) {
  config.iir_config.coeff_set0[index] = iir0[index];
  config.iir_config.coeff_set1[index] = iir1[index];
 }
 /* Set RGBPOSITION */
 config.rgb_pos = GR_BG_BAYER;
 printf("\n Before SEt Params");
 /* Call AF_S_PARAM to do the configuration */
     buff_size  = ioctl(fd,AF_S_PARAM,&config);