I am trying to set up the histogram function in the VPFE. I get the interrupt telling me the frame is complete but all the histogram data is 0. Image data is non-zero. There is probably some switch or setting I have overlooked. Any pointers would be appreciated.
Below is a section of code I used for setting up the VPFE:
VPSS_PCR = 0; // clear any junk errors
CFG_VPSS_CLKCTL = 0x00000004;
VPFE_CCDC_CCDCFG |= 0x00008000; // Necessary for proper vpfe function
VPFE_CCDC_SYN_MODE = 0x00030400; //* 12 bit raw with hd/vd as inputs stored as 2 bytes
VPFE_CCDC_HORZ_INFO = (0 << 16) | //* Get rid of XY code in output image
image->ROI.LengthX-1;
VPFE_CCDC_VERT_START = 0; //*
VPFE_CCDC_VERT_LINES = image->ROI.LengthY-1;
VPFE_CCDC_HSIZE_OFF = image->ROI.LengthY+1; // careful here as this ignores any %16 or %32 remainder depending on PACK8 in SYN_MODE
VPFE_CCDC_SDR_ADDR = (Uint32)(image->Image);
VPFE_CCDC_VDINT = ((image->ROI.LengthY/2) << 16) // VDINT0 set to half way just for testing
| (image->ROI.LengthY-1); // VDINT1
// histogram init
VPFE_CCDC_FMTCFG = 0x0000E000; // enable video formater take bits 11-2
VPFE_CCDC_FMT_HORZ= (0 << 16) | image->ROI.LengthX;
VPFE_CCDC_FMT_VERT= (0 << 16) | image->ROI.LengthY;
VPFE_CCDC_VP_OUT= ((image->ROI.LengthY-1) << 17) | (image->ROI.LengthX << 4);
VPFE_HIST_HIST_CNT = 0x000000B0; // clear data after read, 256 bins, input from CCD,
//X debug shift right 4 bits (12 bit input)
VPFE_HIST_R0_HORZ = image->ROI.LengthX-1;
VPFE_HIST_R0_VERT = image->ROI.LengthY-1;
Snippet for reading some histogram data:
VPFE_HIST_HIST_ADDR=i;
bin=VPFE_HIST_HIST_DATA;
if (bin==0xFFFFF)
overflow=1;
else
sum+=bin;