阅读:5952回复:15
tvp5150+s3c2440 camera
论坛有位兄台已解决过该问题,但是没有贴出解决的方法。我现在也正在调 tvp5150 + 2440 的 Camera,目前遇到的问题,Camera 中断已过来,但是显示的图像是花屏,不知为何,哪位大侠能帮帮我,或是提供一些参考的 sample code ,估计是 CamInit 或 Display_Cam_Image 函数设置不对,非常谢谢了, email: iqcwei@gmail.com
|
|
最新喜欢:heavyk |
沙发#
发布于:2008-05-23 09:38
我调过,但我原来没出现过花屏的情况,没法帮你啊
|
|
板凳#
发布于:2008-05-23 11:16
我把相关的几个函数贴出来,帮忙看一下
void Camera_Clock(unsigned char divide) { DWORD camclk; // Set camera clock for camera processor s2440PWR->CAMDIVN = (s2440PWR->CAMDIVN & ~(0x1f)) | (1<<4) | (divide & 0xf); // CAMCLK is divided.. camclk = 48000000/(((s2440PWR->CAMDIVN & 0xf) + 1)*2); } void CAM_IF_Reset() { s2440CAM->CISRCFMT |= (1<<31); s2440CAM->CIGCTRL |= (1<<31|1<<29); // Don't modify this delay time //RETAILMSG(1,(TEXT("Camera I/F Reset\r\n"))); Delay(1000); s2440CAM->CIGCTRL &= ~((1<<31)|(0x3<<27)|(1<<26)|(1<<25)|(1<<24)); // Wait for Camera module initialization Delay(1000); } void Camera_Module_Reset() { s2440CAM->CIGCTRL |= (1<<30); // Don't modify this delay time //RETAILMSG(1,(TEXT("Camera Module Reset\r\n"))); Delay(100); s2440CAM->CIGCTRL &= ~(1<<30); // Wait for Camera module initialization Delay(1000); s2440CAM->CIGCTRL |= (1<<30); } void CamInit(U32 CoDstWidth, U32 CoDstHeight, U32 PrDstWidth, U32 PrDstHeight, U32 WinHorOffset, U32 WinVerOffset, U32 CoFrameBuffer, U32 PrFrameBuffer) { U32 WinOfsEn; U32 divisor, multiplier; U32 MainBurstSizeY, RemainedBurstSizeY, MainBurstSizeC, RemainedBurstSizeC, MainBurstSizeRGB, RemainedBurstSizeRGB; U32 H_Shift, V_Shift, PreHorRatio, PreVerRatio, MainHorRatio, MainVerRatio; U32 SrcWidth, SrcHeight; U32 ScaleUp_H_Co, ScaleUp_V_Co, ScaleUp_H_Pr, ScaleUp_V_Pr; WinHorOffset = 0; WinVerOffset = 0; //constant for calculating codec dma address if(CAM_CODEC_OUTPUT) divisor=2; //CCIR-422 else divisor=4; //CCIR-420 //constant for calculating preview dma address if(CAM_PVIEW_OUTPUT) multiplier=4; else multiplier=2; if(WinHorOffset==0 && WinVerOffset==0) WinOfsEn=0; else WinOfsEn=1; SrcWidth=CAM_SRC_HSIZE-WinHorOffset*2; SrcHeight=CAM_SRC_VSIZE-WinVerOffset*2; if(SrcWidth>=CoDstWidth) ScaleUp_H_Co=0; //down else ScaleUp_H_Co=1; //up if(SrcHeight>=CoDstHeight) ScaleUp_V_Co=0; else ScaleUp_V_Co=1; if(SrcWidth>=PrDstWidth) ScaleUp_H_Pr=0; //down else ScaleUp_H_Pr=1; //up if(SrcHeight>=PrDstHeight) ScaleUp_V_Pr=0; else ScaleUp_V_Pr=1; ////////////////// common control setting // s2440CAM->CIGCTRL |= (1<<26)|(0<<27); // inverse PCLK, test pattern s2440CAM->CIGCTRL |= (0<<25)|(0<<26)|(0<<27); s2440CAM->CIWDOFST = (1<<30)|(0xf<<12); // clear overflow s2440CAM->CIWDOFST = 0; s2440CAM->CIWDOFST=(WinOfsEn<<31)|(WinHorOffset<<16)|(WinVerOffset); /* #if(CIS_TYPE == CIS_S5X3A1) s2440CAM->CISRCFMT=(CAM_ITU601<<31)|(0<<30)|(0<<29)|(CAM_SRC_HSIZE<<16)|(CAM_ORDER_YCBYCR<<14)|(CAM_SRC_VSIZE); #elif(CIS_TYPE == CIS_S5K3AA) s2440CAM->CISRCFMT=(CAM_ITU601<<31)|(0<<30)|(0<<29)|(CAM_SRC_HSIZE<<16)|(CAM_ORDER_YCRYCB<<14)|(CAM_SRC_VSIZE); #elif(CIS_TYPE == CIS_S5K3BAFB) s2440CAM->CISRCFMT=(CAM_ITU601<<31)|(0<<30)|(0<<29)|(CAM_SRC_HSIZE<<16)|(CAM_ORDER_YCBYCR<<14)|(CAM_SRC_VSIZE); #endif */ s2440CAM->CISRCFMT=(CAM_ITU656<<31)|(0<<30)|(0<<29)|(CAM_SRC_HSIZE<<16)|(CAM_ORDER_YCRYCB<<14)|(CAM_SRC_VSIZE); ////////////////// codec port setting s2440CAM->CICOYSA1=CoFrameBuffer; s2440CAM->CICOYSA2=s2440CAM->CICOYSA1+CoDstWidth*CoDstHeight+2*CoDstWidth*CoDstHeight/divisor; if(CoDstWidth*CoDstHeight < 655360) // Codec Max. Size = 1280*1024 Above sXGA, use only 2 memory of the 4 pingpong memory { s2440CAM->CICOYSA3=s2440CAM->CICOYSA2+CoDstWidth*CoDstHeight+2*CoDstWidth*CoDstHeight/divisor; s2440CAM->CICOYSA4=s2440CAM->CICOYSA3+CoDstWidth*CoDstHeight+2*CoDstWidth*CoDstHeight/divisor; } else { s2440CAM->CICOYSA3=s2440CAM->CICOYSA1; s2440CAM->CICOYSA4=s2440CAM->CICOYSA2; } s2440CAM->CICOCBSA1=s2440CAM->CICOYSA1+CoDstWidth*CoDstHeight; s2440CAM->CICOCBSA2=s2440CAM->CICOYSA2+CoDstWidth*CoDstHeight; s2440CAM->CICOCBSA3=s2440CAM->CICOYSA3+CoDstWidth*CoDstHeight; s2440CAM->CICOCBSA4=s2440CAM->CICOYSA4+CoDstWidth*CoDstHeight; s2440CAM->CICOCRSA1=s2440CAM->CICOCBSA1+CoDstWidth*CoDstHeight/divisor; s2440CAM->CICOCRSA2=s2440CAM->CICOCBSA2+CoDstWidth*CoDstHeight/divisor; s2440CAM->CICOCRSA3=s2440CAM->CICOCBSA3+CoDstWidth*CoDstHeight/divisor; s2440CAM->CICOCRSA4=s2440CAM->CICOCBSA4+CoDstWidth*CoDstHeight/divisor; g_CodecFrameSize = CoDstWidth*CoDstHeight+2*CoDstWidth*CoDstHeight/divisor; s2440CAM->CICOTRGFMT=(CAM_CODEC_IN_422<<31)|(CAM_CODEC_OUTPUT<<30)|(CoDstWidth<<16)|(CAM_FLIP_NORMAL<<14)|(CoDstHeight); CalculateBurstSize(CoDstWidth, &MainBurstSizeY, &RemainedBurstSizeY); CalculateBurstSize(CoDstWidth/2, &MainBurstSizeC, &RemainedBurstSizeC); s2440CAM->CICOCTRL=(MainBurstSizeY<<19)|(RemainedBurstSizeY<<14)|(MainBurstSizeC<<9)|(RemainedBurstSizeC<<4); CalculatePrescalerRatioShift(SrcWidth, CoDstWidth, &PreHorRatio, &H_Shift); CalculatePrescalerRatioShift(SrcHeight, CoDstHeight, &PreVerRatio, &V_Shift); MainHorRatio=(SrcWidth<<8)/(CoDstWidth<<H_Shift); MainVerRatio=(SrcHeight<<8)/(CoDstHeight<<V_Shift); s2440CAM->CICOSCPRERATIO=((10-H_Shift-V_Shift)<<28)|(PreHorRatio<<16)|(PreVerRatio); s2440CAM->CICOSCPREDST=((SrcWidth/PreHorRatio)<<16)|(SrcHeight/PreVerRatio); s2440CAM->CICOSCCTRL=(CAM_SCALER_BYPASS_OFF<<31)|(ScaleUp_H_Co<<30)|(ScaleUp_V_Co<<29)|(MainHorRatio<<16)|(1<<15)|(MainVerRatio); s2440CAM->CICOTAREA=CoDstWidth*CoDstHeight; ///////////////// preview port setting s2440CAM->CIPRCLRSA1=PrFrameBuffer; s2440CAM->CIPRCLRSA2=s2440CAM->CIPRCLRSA1+PrDstWidth*PrDstHeight*multiplier; s2440CAM->CIPRCLRSA3=s2440CAM->CIPRCLRSA2+PrDstWidth*PrDstHeight*multiplier; s2440CAM->CIPRCLRSA4=s2440CAM->CIPRCLRSA3+PrDstWidth*PrDstHeight*multiplier; /* if(CIS_TYPE == CIS_S5X3A1) s2440CAM->CIPRTRGFMT=(PrDstWidth<<16)|(CAM_FLIP_YAXIS<<14)|(PrDstHeight); else s2440CAM->CIPRTRGFMT=(PrDstWidth<<16)|(CAM_FLIP_NORMAL<<14)|(PrDstHeight);*/ s2440CAM->CIPRTRGFMT=(PrDstWidth<<16)|(CAM_FLIP_NORMAL<<14)|(PrDstHeight); if (CAM_PVIEW_OUTPUT==CAM_RGB24B) CalculateBurstSize(PrDstWidth*4, &MainBurstSizeRGB, &RemainedBurstSizeRGB); else // RGB16B CalculateBurstSize(PrDstWidth*2, &MainBurstSizeRGB, &RemainedBurstSizeRGB); s2440CAM->CIPRCTRL=(MainBurstSizeRGB<<19)|(RemainedBurstSizeRGB<<14); CalculatePrescalerRatioShift(SrcWidth, PrDstWidth, &PreHorRatio, &H_Shift); CalculatePrescalerRatioShift(SrcHeight, PrDstHeight, &PreVerRatio, &V_Shift); MainHorRatio=(SrcWidth<<8)/(PrDstWidth<<H_Shift); MainVerRatio=(SrcHeight<<8)/(PrDstHeight<<V_Shift); s2440CAM->CIPRSCPRERATIO=((10-H_Shift-V_Shift)<<28)|(PreHorRatio<<16)|(PreVerRatio); s2440CAM->CIPRSCPREDST=((SrcWidth/PreHorRatio)<<16)|(SrcHeight/PreVerRatio); s2440CAM->CIPRSCCTRL=(1<<31)|(CAM_RGB16B<<30)|(ScaleUp_H_Pr<<29)|(ScaleUp_V_Pr<<28)|(MainHorRatio<<16)|(1<<15)|(MainVerRatio); s2440CAM->CIPRTAREA= PrDstWidth*PrDstHeight; // initialization for buffer addresses y_address = s2440CAM->CICOYSA1; cb_address = s2440CAM->CICOCBSA1; cr_address = s2440CAM->CICOCRSA1; rgb_address = s2440CAM->CIPRCLRSA1; } |
|
地板#
发布于:2008-05-23 18:01
1.打出串口信息,看是不是有连续的桢输出.
2.用示波器量5150输出波行是不是有问题. 3.显示FRAME_BUFF地址是不是搞错了. |
|
地下室#
发布于:2008-05-24 10:03
To fuklfukl:
谢谢 fuklfukl 的回复。 1. 从串口的显示的调试信息来看,帧很连续,比较均匀的触发相关中断,会进入到 Display_Cam_Image 函数中。 2. 5150 的输出波形都比较正常,YOUT0 ~ YOUT7 都有波形,PCLK 也是正常的 3. FRAME_BUFF 地址应该没有错,我试过COPY一幅图像来显示,是正常的。 补充: 我上面讲的花屏可能不够详细,即图像模糊的可以看见(可以看出是 DVD 正确的图像,但比较模糊),屏幕也是满的,只是图像好像被一分为二了,分成左右两半部分都显示相同的图像,同时颜色很浅。 |
|
5楼#
发布于:2008-05-24 13:06
s2440CAM->rCISRCFMT寄存器,YCBCR信号顺序改成CBYCRY试试。
|
|
6楼#
发布于:2008-05-24 14:30
是的,按照 fuklfukl 所说,s2440CAM->rCISRCFMT寄存器,YCBCR信号顺序改成CBYCRY之后,颜色效果基本正常了,但是仍然是图像被分成两半了。我仔细检查了一下,好像左半部分与右半部分叠加后是全部的图像,即 感觉是这样: 左边显示图像的 0 2 4 8 ... 偶数点, 右边显示图像的 1 3 5 7 ... 奇数点图像。
|
|
7楼#
发布于:2008-05-24 17:19
现在的现象与之前 Sniper167 兄遇到的现象一样了,即 右边一些区域是花屏,左边正常图像.
|
|
8楼#
发布于:2008-05-26 16:15
关注
|
|
9楼#
发布于:2008-08-07 15:13
Preview path contains 640 pixel line buffer. (Codec path contains 2048 pixel line buffer) So, upper 1280 pixels, input images must be pre-scaled by over 1/2 for capturing valid preview image. ((SourceHsize-2*WinHorOfst)/PreHorRatio_Pr) <= 640
|
|
10楼#
发布于:2008-08-07 18:07
楼上正解
我记得以前在一个帖子里面贴出原因了的 难道不是这里? |
|
|
11楼#
发布于:2008-08-18 15:12
求助iqcwei ,图象抖动怎么解决? 郁闷了好几次天了不!
|
|
12楼#
发布于:2009-08-05 13:33
iqcwei :您好!我现在也在调tvp5150+s3c2440 camera ,一直都没有图像出来,那个汗!!!,请问寄存器的配置要怎样配置?能否分享一下的你源代码,谢谢!我邮箱是kaizhili@163.com
|
|
13楼#
发布于:2009-08-05 13:35
期待各位xdjm等牛人指导,偶在此感激不尽!!!!!!
|
|
14楼#
发布于:2009-09-08 15:43
sensor输出的尺寸和你camif设置的尺寸是否相同,花屏一般是这两个没配对!
|
|
15楼#
发布于:2009-10-29 10:36
本人最近也在调试camera驱动(S3C2440A+TVP5150A),问题是本来该在右边显示的图像却在左边显示,在左边显示的这块图像大概占整个图像的的十分之一,不知大家是否遇到这样的问题,麻烦大家帮忙分析一下,谢谢。
|
|