AnsweredAssumed Answered

ADV 212 crash

Question asked by gongjiulu on May 30, 2014
Latest reply on May 30, 2014 by gongjiulu

Hi, I got a problem when using ADV212 (adv212bbcz 150) for JPEG2000 compression, sometimes it crashed.

 

When using "encode_2_18_3COMP_0.sea" after crashed, we find :

EIRQFLG=0x440d

SWFLAG=0xcccc

 

When using "encode_2_13_0.sea" after crashed, we find :

EIRQFLG=0x500d

SWFLAG=0xff82

 

The code we used to config ADV212 and compression setup are as followed, can anyone tell me the reasons? Thanks!

 

PLL_HI=0x0008

 

void Load_ADV212_Firmware(void)

{

  int i;

 

  Set_ADV212_Direct_Register(ADV212_DIRECT_REGISTER_PLL_HI, 0x0008);

  Set_ADV212_Direct_Register(ADV212_DIRECT_REGISTER_PLL_LO, 0x0004); //JCLK = 27*4=108M HCLK=108/2=54M

  delay_ms(1);

  Set_ADV212_Direct_Register(ADV212_DIRECT_REGISTER_BOOT, 0x008a);

  Set_ADV212_Direct_Register(ADV212_DIRECT_REGISTER_BMODE, 0x000a);

  Set_ADV212_Direct_Register(ADV212_DIRECT_REGISTER_MMODE, 0x000a);

 

  Set_ADV212_Direct_Register(ADV212_DIRECT_REGISTER_IADDR , ADV212_FIRMWARE_ADDR_START);

  for(i = 0; i<ADV212_FIRMWARE_SIZE/4; i++)

  {

  Set_ADV212_Direct_Register(ADV212_DIRECT_REGISTER_IDATA, byteswap4(*(u32*)(firmware + 4*i)));

  }

  Set_ADV212_Direct_Register(ADV212_DIRECT_REGISTER_BOOT, 0x008d);

  Set_ADV212_Direct_Register(ADV212_DIRECT_REGISTER_BMODE, 0x000a);

  Set_ADV212_Direct_Register(ADV212_DIRECT_REGISTER_MMODE, 0x000a);

}

 

 

void Set_Encode_Parameters(img_property_t *pImage_ppt)

{

  volatile u32 eir_flag;

  u32 width,height,pmode1,target,thresh,pixel_bytes;

 

  pixel_bytes = 2;

  width = 320;

  height = 256;

  pmode1 = 0x03180000;

  target = (width*height*pixel_bytes)/IMAGE_COMPRESS_RATIO;

  thresh = 8;

 

  Set_ADV212_Direct_Register(ADV212_DIRECT_REGISTER_IADDR, 0x00057f00);

  Set_ADV212_Direct_Register(ADV212_DIRECT_REGISTER_IDATA, 0x04000603); //Custom | 8bit | 6 levels | Unipolar C, Unipolar Y

  Set_ADV212_Direct_Register(ADV212_DIRECT_REGISTER_IDATA, 0x02000000); //64x64  | i9x7 | all fields | No attr

  Set_ADV212_Direct_Register(ADV212_DIRECT_REGISTER_IDATA, (1<<24) + target);

  Set_ADV212_Direct_Register(ADV212_DIRECT_REGISTER_IDATA, 0x00000001); //J2C Format

 

  Set_ADV212_Indirect_Register(ADV212_INDIRECT_REGISTER_PMODE1, pmode1);

  Set_ADV212_Indirect_Register(ADV212_INDIRECT_REGISTER_XTOT, width  << 16);

  Set_ADV212_Indirect_Register(ADV212_INDIRECT_REGISTER_YTOT, height << 16);

  Set_ADV212_Indirect_Register(ADV212_INDIRECT_REGISTER_PMODE2, 0x00300000); //VCLK,VSYNC,HSYNC,FIELD,YUNI,CUNI active edge

  Set_ADV212_Indirect_Register(ADV212_INDIRECT_REGISTER_VMODE , 0x08120000); //VIDEO MODE,slave,encode

  Set_ADV212_Indirect_Register(ADV212_INDIRECT_REGISTER_FFTHRC, thresh << 16); //CODE FIFO threshold = thresh

  Set_ADV212_Direct_Register(ADV212_DIRECT_REGISTER_EIRQIE, 0x0402); //enable interrupt:sw1,pixel and code threshold condition

 

  while(1)

  {

  eir_flag = Get_ADV212_Direct_Register(ADV212_DIRECT_REGISTER_EIRQFLG);

  if(eir_flag & 0x0400)

  {

  if(Get_ADV212_Direct_Register(ADV212_DIRECT_REGISTER_SWFLAG) == 0xFF82)

  {

  printf("Configure adv212 for encoding successed!\n");

  Set_ADV212_Direct_Register(ADV212_DIRECT_REGISTER_EIRQFLG, 0xFFFF);

  break;

  }

  else

  {

  asm("emuexcpt;");

  }

  }

  }

 

}

Outcomes