Other Parts Discussed in Thread: AM3505
Hello,
I am configuring the AM3505 VPFE for raw 8 bit data mode. The VPFE busy bit toggles indicating it is processing data. However, when I look in the DDR memory locations the data is not stored in external memory. What can cause this?
Here are my settings: Are any additional modules required to get the VPFE to store the data frame in external memory?
int configure_CCDC_pins(void)
{
//see TRM pg 628
UINT16 ccdc_padconfig = ( M0 | IEN | PD ); //Mode 0, Input Enabled, pull down
//VPFE Setup
SCM_CONTROL_PADCONF_CCDC_PCLK_REG = ccdc_padconfig;
SCM_CONTROL_PADCONF_CCDC_HD_REG = ccdc_padconfig;
SCM_CONTROL_PADCONF_CCDC_VD_REG = ccdc_padconfig;
SCM_CONTROL_PADCONF_CCDC_DATA0_REG = ccdc_padconfig;
SCM_CONTROL_PADCONF_CCDC_DATA1_REG = ccdc_padconfig;
SCM_CONTROL_PADCONF_CCDC_DATA2_REG = ccdc_padconfig;
SCM_CONTROL_PADCONF_CCDC_DATA3_REG = ccdc_padconfig;
SCM_CONTROL_PADCONF_CCDC_DATA4_REG = ccdc_padconfig;
SCM_CONTROL_PADCONF_CCDC_DATA5_REG = ccdc_padconfig;
SCM_CONTROL_PADCONF_CCDC_DATA6_REG = ccdc_padconfig;
SCM_CONTROL_PADCONF_CCDC_DATA7_REG = ccdc_padconfig;
ccdc_padconfig = ( M1 | IEN | PD );
SCM_CONTROL_PADCONF_CCDC_FIELD_REG = ccdc_padconfig; //DATA8
SCM_CONTROL_PADCONF_CCDC_WEN_REG = ccdc_padconfig; //DATA9
//Configure GPIO controls
//Make sure all GPIOs are disabled first to guarentee that enable pin works
Am35xxGpioDisablePin( kCMOS_STDBY );
Am35xxGpioDisablePin( kCMOS_TRIG );
Am35xxGpioDisablePin( kCMOS_LOCK );
Am35xxGpioDisablePin( kCMOS_BIST_PASS );
Am35xxGpioDisablePin( kCMOS_BISTEN );
Am35xxGpioDisablePin( kCMOS_PDB_EN );
Am35xxGpioDisablePin( kCMOS_RST );
Am35xxGpioDisablePin( kUM_CMOS_PS_EN );
Am35xxGpioDisablePin( kUM_BAR_3P3V );
Am35xxGpioDisablePin( kUM_BAR_IMAG_ON );
Am35xxGpioDisablePin( kUM_BAR_AIM_ON );
Am35xxGpioDisablePin( kUM_BAR_ILLUM_ON );
Am35xxGpioDisablePin( kUM_BAR_HIGHZ );
Am35xxGpioDisablePin( kCCDC_SELECT );
//Set Direction and default value
Am35xxGpioEnablePin( kCMOS_STDBY, kAM35XX_GPIO_OUTPUT, 0 );
Am35xxGpioEnablePin( kCMOS_TRIG, kAM35XX_GPIO_OUTPUT, 0 );
Am35xxGpioEnablePin( kCMOS_LOCK, kAM35XX_GPIO_INPUT, 0 );
Am35xxGpioEnablePin( kCMOS_BIST_PASS, kAM35XX_GPIO_INPUT, 0 );
Am35xxGpioEnablePin( kCMOS_BISTEN, kAM35XX_GPIO_OUTPUT, 0 );
Am35xxGpioEnablePin( kCMOS_PDB_EN, kAM35XX_GPIO_OUTPUT, 0 );
Am35xxGpioEnablePin( kCMOS_RST, kAM35XX_GPIO_OUTPUT, 1 );
Am35xxGpioEnablePin( kUM_CMOS_PS_EN, kAM35XX_GPIO_OUTPUT, 0 );
Am35xxGpioEnablePin( kUM_BAR_3P3V, kAM35XX_GPIO_OUTPUT, 0 );
Am35xxGpioEnablePin( kUM_BAR_IMAG_ON, kAM35XX_GPIO_OUTPUT, 0 );
Am35xxGpioEnablePin( kUM_BAR_AIM_ON, kAM35XX_GPIO_OUTPUT, 0 );
Am35xxGpioEnablePin( kUM_BAR_ILLUM_ON, kAM35XX_GPIO_OUTPUT, 0 );
Am35xxGpioEnablePin( kUM_BAR_HIGHZ, kAM35XX_GPIO_OUTPUT, 0 );
Am35xxGpioEnablePin( kCCDC_SELECT, kAM35XX_GPIO_OUTPUT, 0 ); //0 - Select BARCODE, 1 - Select CMOS
return 0;
}
int init_VPFE(void)
{
VPFE_PCR_REG = 0; //Make sure VPFE is disabled
//Init registers to 0
VPFE_SYN_MODE_REG = 0;
VPFE_HORZ_INFO_REG = 0;
VPFE_VERT_START_REG = 0;
VPFE_VERT_LINES_REG = 0;
VPFE_CULLING_REG = 0;
VPFE_HSIZE_OFF_REG = 0;
VPFE_SDOFST_REG = 0;
VPFE_SDR_ADDR_REG = 0;
VPFE_CLAMP_REG = 0;
VPFE_DCSUB_REG = 0;
VPFE_COLPTN_REG = 0;
VPFE_BLKCMP_REG = 0;
VPFE_VDINT_REG = 0;
VPFE_ALAW_REG = 0;
VPFE_REC656IF_REG = 0;
VPFE_CCDCCFG_REG = 0;
VPFE_DMA_CNTL_REG = 0;
VPFE_SYN_MODE_REG |= ( VPFE_PACK8 | VPFE_DATSIZ_8BIT ); //Set packed 8bit data , pixel is 8bit. 4 pixels per 32 bit word
VPFE_HORZ_INFO_REG = kFULL_MAX_IMAGE_WIDTH - 1; //Start saving data 0 pixels after HD.
VPFE_HSIZE_OFF_REG = kFULL_MAX_IMAGE_WIDTH; //Line offset in memory
VPFE_VERT_LINES_REG = kFULL_MAX_IMAGE_HEIGHT - 1; //Number of lines
VPFE_CCDCCFG_REG |= ( 0x1 << 15 ); //Latch all VD registers now
//Setup Interrupt for end of frame - VD0 is IRQ 88
VPFE_VDINT_REG = ( kFULL_MAX_IMAGE_HEIGHT - 1 ) << 16;
VPFE_SDR_ADDR_REG = &image_data_buffer[0]; //Point DMA at memory
printf("Image Buffer Address = %X\n", &image_data_buffer[0] );
VPFE_PCR_REG |= ( 0x1 << 0 ); //Enable VPFE
return 0;
}
int enableImageCapture(void)
{
VPFE_SYN_MODE_REG |= ( VPFE_WEN | VPFE_VDHDEN ); //Only do this if SDR_ADDR has a valid memory address
return 0;
}
int disableImageCapture(void)
{
VPFE_SYN_MODE_REG &= ~( VPFE_WEN | VPFE_VDHDEN );
return 0;
}
int waitFor_EOF(void)
{
//The VPFE will be busy during the data section of a frame
while( ( VPFE_PCR_REG & ( 0x1 << 1 )) == ( 0x1 << 1 ) ) {printf("VPFE is busy with data\n");}; //wait while busy
return 0;
}
int waitFor_SOF(void)
{
//The VPFE will be busy during the data section of a frame
while( ( VPFE_PCR_REG & ( 0x1 << 1 )) == 0 ) {printf("Waiting for frame to start\n");}; //wait until busy
return 0;
}
//capture image routine
int getSingleImage(void)
{
//Init pinmux
configure_CCDC_pins();
//Turn on Power
barcode_on();
//Init more stuff
initBarcode_I2C_Regs();
init_VPFE();
vxbMsDelay( 100 );
//Throw away first frame
enableImageCapture();
waitFor_SOF();
waitFor_EOF(); //This is the first frame
waitFor_SOF();
waitFor_EOF(); //We can keep this one
disableImageCapture();
barcode_off();
//Now image_data_buffer contains the sensor data, need to format it and save it to disk
return 0;
}