关于主程序,本人一直卡在图像显示偏绿或者偏蓝上。经过分析,感觉是摄像头寄存器配置的问题,但依据《OV5640_自动对焦照相模组应用指南(DVP_接口)》的相关配置,查找了一遍又一遍的错误,结果显示仍不正常。其中,光200多个寄存器与配置值的对应关系,就查了不下于10遍。
依据《应用指南》得,配置为30FPS的800*480预览时,pclk为91.2MHz。但是,经过计算和测试发现,PCLK的值不应该为这么多,而且此时显示也不正常。
后来,使用CrazyBingo的OV5640寄存器配置代码,发现终于能正常显示了。
在正常显示的代码上,依据《应用指南》修改了相关寄存,配置为800*480预览,结果发现,显示偏蓝,而且纹波很大。由此可自信得出,《应用指南》此处有误的结论。
///////////////////// Config Data LUT ////////////////////////// always@(*) begin case(LUT_INDEX) // 800x480 30fps, night mode 5fps // 24MHz input clock, 91.2MHz PCLK SET_OV5640 + 0 : LUT_DATA = 24'h3103_11; // system clock from pad, bit[1]--可有可无 SET_OV5640 + 1 : LUT_DATA = 24'h3008_82; // software reset, bit[7]--可有可无 SET_OV5640 + 2 : LUT_DATA = 24'h3008_42; // software power down, bit[6] SET_OV5640 + 3 : LUT_DATA = 24'h3103_03; // system clock from PLL, bit[1] SET_OV5640 + 4 : LUT_DATA = 24'h3017_ff; // FREX, Vsync, HREF, PCLK, D[9:6] output enable SET_OV5640 + 5 : LUT_DATA = 24'h3018_ff; // D[5:0], GPIO[1:0] output enable SET_OV5640 + 6 : LUT_DATA = 24'h3034_1a; // MIPI 10-bit SET_OV5640 + 7 : LUT_DATA = 24'h3037_13; // PLL root divider, bit[4], PLL pre-divider, bit[3:0] SET_OV5640 + 8 : LUT_DATA = 24'h3108_01; // PCLK root divider, bit[5:4], SCLK2x root divider, bit[3:2] SET_OV5640 + 9 : LUT_DATA = 24'h3630_36;// SCLK root divider, bit[1:0] SET_OV5640 + 10 : LUT_DATA = 24'h3631_0e; SET_OV5640 + 11 : LUT_DATA = 24'h3632_e2; SET_OV5640 + 12 : LUT_DATA = 24'h3633_12; SET_OV5640 + 13 : LUT_DATA = 24'h3621_e0; SET_OV5640 + 14 : LUT_DATA = 24'h3704_a0; SET_OV5640 + 15 : LUT_DATA = 24'h3703_5a; SET_OV5640 + 16 : LUT_DATA = 24'h3715_78; SET_OV5640 + 17 : LUT_DATA = 24'h3717_01; SET_OV5640 + 18 : LUT_DATA = 24'h370b_60; SET_OV5640 + 19 : LUT_DATA = 24'h3705_1a; SET_OV5640 + 20 : LUT_DATA = 24'h3905_02; SET_OV5640 + 21 : LUT_DATA = 24'h3906_10; SET_OV5640 + 22 : LUT_DATA = 24'h3901_0a; SET_OV5640 + 23 : LUT_DATA = 24'h3731_12; SET_OV5640 + 24 : LUT_DATA = 24'h3600_08; // VCM control SET_OV5640 + 25 : LUT_DATA = 24'h3601_33; // VCM control SET_OV5640 + 26 : LUT_DATA = 24'h302d_60; // system control SET_OV5640 + 27 : LUT_DATA = 24'h3620_52; SET_OV5640 + 28 : LUT_DATA = 24'h371b_20; SET_OV5640 + 29 : LUT_DATA = 24'h471c_50; SET_OV5640 + 30 : LUT_DATA = 24'h3a13_43; // pre-gain = 1.047x SET_OV5640 + 31 : LUT_DATA = 24'h3a18_00; // gain ceiling SET_OV5640 + 32 : LUT_DATA = 24'h3a19_f8; // gain ceiling = 15.5x f8-15.5x 7c-7.75x SET_OV5640 + 33 : LUT_DATA = 24'h3635_13; SET_OV5640 + 34 : LUT_DATA = 24'h3636_03; SET_OV5640 + 35 : LUT_DATA = 24'h3634_40; SET_OV5640 + 36 : LUT_DATA = 24'h3622_01; // 50/60Hz detection 50/60Hz 灯光条纹过滤 SET_OV5640 + 37 : LUT_DATA = 24'h3c01_34; // Band auto, bit[7] SET_OV5640 + 38 : LUT_DATA = 24'h3c04_28; // threshold low sum SET_OV5640 + 39 : LUT_DATA = 24'h3c05_98; // threshold high sum SET_OV5640 + 40 : LUT_DATA = 24'h3c06_00; // light meter 1 threshold[15:8] SET_OV5640 + 41 : LUT_DATA = 24'h3c07_08; // light meter 1 threshold[7:0] 08->07 SET_OV5640 + 42 : LUT_DATA = 24'h3c08_00; // light meter 2 threshold[15:8] SET_OV5640 + 43 : LUT_DATA = 24'h3c09_1c; // light meter 2 threshold[7:0] SET_OV5640 + 44 : LUT_DATA = 24'h3c0a_9c; // sample number[15:8] SET_OV5640 + 45 : LUT_DATA = 24'h3c0b_40; // sample number[7:0] SET_OV5640 + 46 : LUT_DATA = 24'h3810_00; // Timing Hoffset[11:8] SET_OV5640 + 47 : LUT_DATA = 24'h3811_10; // Timing Hoffset[7:0] SET_OV5640 + 48 : LUT_DATA = 24'h3812_00; // Timing Voffset[10:8] SET_OV5640 + 49 : LUT_DATA = 24'h3708_64; SET_OV5640 + 50 : LUT_DATA = 24'h4001_02; // BLC start from line 2 SET_OV5640 + 51 : LUT_DATA = 24'h4005_1a; // BLC always update SET_OV5640 + 52 : LUT_DATA = 24'h3000_00; // enable blocks SET_OV5640 + 53 : LUT_DATA = 24'h3004_ff; // enable clocks SET_OV5640 + 54 : LUT_DATA = 24'h300e_58; // MIPI power down, DVP enable SET_OV5640 + 55 : LUT_DATA = 24'h302e_00; // SET_OV5640 + 56 : LUT_DATA = 24'h4300_61; // 0x6---RGB565--0x1 {r[4:0],g[5:3]} {g[2:0],b[4:0]}偏红 SET_OV5640 + 56 : LUT_DATA = 24'h4300_60; // 0x6---RGB565--0x0 {b[4:0],g[5:3]} {g[2:0],r[4:0]}偏蓝 SET_OV5640 + 57 : LUT_DATA = 24'h501f_01; // RGB565 SET_OV5640 + 58 : LUT_DATA = 24'h440e_00; SET_OV5640 + 59 : LUT_DATA = 24'h5000_a7; // Lenc on, raw gamma on, BPC on, WPC on, CIP on // AEC target 自动曝光控制--- /*changed for EV+1*/ // SET_OV5640 + 60 : LUT_DATA = 24'h3a0f_40; // stable range in high // SET_OV5640 + 61 : LUT_DATA = 24'h3a10_38; // stable range in low // SET_OV5640 + 62 : LUT_DATA = 24'h3a1b_40; // stable range out high // SET_OV5640 + 63 : LUT_DATA = 24'h3a1e_38; // stable range out low // SET_OV5640 + 64 : LUT_DATA = 24'h3a11_71; // fast zone high // SET_OV5640 + 65 : LUT_DATA = 24'h3a1f_10; // fast zone low SET_OV5640 + 60 : LUT_DATA = 24'h3a0f_30; // stable range in high SET_OV5640 + 61 : LUT_DATA = 24'h3a10_28; // stable range in low SET_OV5640 + 62 : LUT_DATA = 24'h3a1b_30; // stable range out high SET_OV5640 + 63 : LUT_DATA = 24'h3a1e_26; // stable range out low SET_OV5640 + 64 : LUT_DATA = 24'h3a11_60; // fast zone high SET_OV5640 + 65 : LUT_DATA = 24'h3a1f_14; // fast zone low // Lens correction for ? 镜头补偿 SET_OV5640 + 66 : LUT_DATA = 24'h5800_23; SET_OV5640 + 67 : LUT_DATA = 24'h5801_14; SET_OV5640 + 68 : LUT_DATA = 24'h5802_0f; SET_OV5640 + 69 : LUT_DATA = 24'h5803_0f; SET_OV5640 + 70 : LUT_DATA = 24'h5804_12; SET_OV5640 + 71 : LUT_DATA = 24'h5805_26; SET_OV5640 + 72 : LUT_DATA = 24'h5806_0c; SET_OV5640 + 73 : LUT_DATA = 24'h5807_08; SET_OV5640 + 74 : LUT_DATA = 24'h5808_05; SET_OV5640 + 75 : LUT_DATA = 24'h5809_05; SET_OV5640 + 76 : LUT_DATA = 24'h580a_08; SET_OV5640 + 77 : LUT_DATA = 24'h580b_0d; SET_OV5640 + 78 : LUT_DATA = 24'h580c_08; SET_OV5640 + 79 : LUT_DATA = 24'h580d_03; SET_OV5640 + 80 : LUT_DATA = 24'h580e_00; SET_OV5640 + 81 : LUT_DATA = 24'h580f_00; SET_OV5640 + 82 : LUT_DATA = 24'h5810_03; SET_OV5640 + 83 : LUT_DATA = 24'h5811_09; SET_OV5640 + 84 : LUT_DATA = 24'h5812_07; SET_OV5640 + 85 : LUT_DATA = 24'h5813_03; SET_OV5640 + 86 : LUT_DATA = 24'h5814_00; SET_OV5640 + 87 : LUT_DATA = 24'h5815_01; SET_OV5640 + 88 : LUT_DATA = 24'h5816_03; SET_OV5640 + 89 : LUT_DATA = 24'h5817_08; SET_OV5640 + 90 : LUT_DATA = 24'h5818_0d; SET_OV5640 + 91 : LUT_DATA = 24'h5819_08; SET_OV5640 + 92 : LUT_DATA = 24'h581a_05; SET_OV5640 + 93 : LUT_DATA = 24'h581b_06; SET_OV5640 + 94 : LUT_DATA = 24'h581c_08; SET_OV5640 + 95 : LUT_DATA = 24'h581d_0e; SET_OV5640 + 96 : LUT_DATA = 24'h581e_29; SET_OV5640 + 97 : LUT_DATA = 24'h581f_17; SET_OV5640 + 98 : LUT_DATA = 24'h5820_11; SET_OV5640 + 99 : LUT_DATA = 24'h5821_11; SET_OV5640 + 100: LUT_DATA = 24'h5822_15; SET_OV5640 + 101: LUT_DATA = 24'h5823_28; SET_OV5640 + 102: LUT_DATA = 24'h5824_46; SET_OV5640 + 103: LUT_DATA = 24'h5825_26; SET_OV5640 + 104: LUT_DATA = 24'h5826_08; SET_OV5640 + 105: LUT_DATA = 24'h5827_26; SET_OV5640 + 106: LUT_DATA = 24'h5828_64; SET_OV5640 + 107: LUT_DATA = 24'h5829_26; SET_OV5640 + 108: LUT_DATA = 24'h582a_24; SET_OV5640 + 109: LUT_DATA = 24'h582b_22; SET_OV5640 + 110: LUT_DATA = 24'h582c_24; SET_OV5640 + 111: LUT_DATA = 24'h582d_24; SET_OV5640 + 112: LUT_DATA = 24'h582e_06; SET_OV5640 + 113: LUT_DATA = 24'h582f_22; SET_OV5640 + 114: LUT_DATA = 24'h5830_40; SET_OV5640 + 115: LUT_DATA = 24'h5831_42; SET_OV5640 + 116: LUT_DATA = 24'h5832_24; SET_OV5640 + 117: LUT_DATA = 24'h5833_26; SET_OV5640 + 118: LUT_DATA = 24'h5834_24; SET_OV5640 + 119: LUT_DATA = 24'h5835_22; SET_OV5640 + 120: LUT_DATA = 24'h5836_22; SET_OV5640 + 121: LUT_DATA = 24'h5837_26; SET_OV5640 + 122: LUT_DATA = 24'h5838_44; SET_OV5640 + 123: LUT_DATA = 24'h5839_24; SET_OV5640 + 124: LUT_DATA = 24'h583a_26; SET_OV5640 + 125: LUT_DATA = 24'h583b_28; SET_OV5640 + 126: LUT_DATA = 24'h583c_42; SET_OV5640 + 127: LUT_DATA = 24'h583d_ce; // lenc BR offset // AWB 自动白平衡 SET_OV5640 + 128: LUT_DATA = 24'h5180_ff; // AWB B block SET_OV5640 + 129: LUT_DATA = 24'h5181_f2; // AWB control SET_OV5640 + 130: LUT_DATA = 24'h5182_00; // [7:4] max local counter, [3:0] max fast counter SET_OV5640 + 131: LUT_DATA = 24'h5183_14; // AWB advanced SET_OV5640 + 132: LUT_DATA = 24'h5184_25; SET_OV5640 + 133: LUT_DATA = 24'h5185_24; SET_OV5640 + 134: LUT_DATA = 24'h5186_09; SET_OV5640 + 135: LUT_DATA = 24'h5187_09; SET_OV5640 + 136: LUT_DATA = 24'h5188_09; SET_OV5640 + 137: LUT_DATA = 24'h5189_75; SET_OV5640 + 138: LUT_DATA = 24'h518a_54; SET_OV5640 + 139: LUT_DATA = 24'h518b_e0; SET_OV5640 + 140: LUT_DATA = 24'h518c_b2; SET_OV5640 + 141: LUT_DATA = 24'h518d_42; SET_OV5640 + 142: LUT_DATA = 24'h518e_3d; SET_OV5640 + 143: LUT_DATA = 24'h518f_56; SET_OV5640 + 144: LUT_DATA = 24'h5190_46; SET_OV5640 + 145: LUT_DATA = 24'h5191_f8; // AWB top limit SET_OV5640 + 146: LUT_DATA = 24'h5192_04; // AWB bottom limit SET_OV5640 + 147: LUT_DATA = 24'h5193_70; // red limit SET_OV5640 + 148: LUT_DATA = 24'h5194_f0; // green limit SET_OV5640 + 149: LUT_DATA = 24'h5195_f0; // blue limit SET_OV5640 + 150: LUT_DATA = 24'h5196_03; // AWB control SET_OV5640 + 151: LUT_DATA = 24'h5197_01; // local limit SET_OV5640 + 152: LUT_DATA = 24'h5198_04; SET_OV5640 + 153: LUT_DATA = 24'h5199_12; SET_OV5640 + 154: LUT_DATA = 24'h519a_04; SET_OV5640 + 155: LUT_DATA = 24'h519b_00; SET_OV5640 + 156: LUT_DATA = 24'h519c_06; SET_OV5640 + 157: LUT_DATA = 24'h519d_82; SET_OV5640 + 158: LUT_DATA = 24'h519e_38; // AWB control // Gamma 伽玛曲线 SET_OV5640 + 159: LUT_DATA = 24'h5480_01; // Gamma bias plus on, bit[0] SET_OV5640 + 160: LUT_DATA = 24'h5481_08; SET_OV5640 + 161: LUT_DATA = 24'h5482_14; SET_OV5640 + 162: LUT_DATA = 24'h5483_28; SET_OV5640 + 163: LUT_DATA = 24'h5484_51; SET_OV5640 + 164: LUT_DATA = 24'h5485_65; SET_OV5640 + 165: LUT_DATA = 24'h5486_71; SET_OV5640 + 166: LUT_DATA = 24'h5487_7d; SET_OV5640 + 167: LUT_DATA = 24'h5488_87; SET_OV5640 + 168: LUT_DATA = 24'h5489_91; SET_OV5640 + 169: LUT_DATA = 24'h548a_9a; SET_OV5640 + 170: LUT_DATA = 24'h548b_aa; SET_OV5640 + 171: LUT_DATA = 24'h548c_b8; SET_OV5640 + 172: LUT_DATA = 24'h548d_cd; SET_OV5640 + 173: LUT_DATA = 24'h548e_dd; SET_OV5640 + 174: LUT_DATA = 24'h548f_ea; SET_OV5640 + 175: LUT_DATA = 24'h5490_1d; // color matrix 色彩矩阵 SET_OV5640 + 176: LUT_DATA = 24'h5381_1e; // CMX1 for Y SET_OV5640 + 177: LUT_DATA = 24'h5382_5b; // CMX2 for Y SET_OV5640 + 178: LUT_DATA = 24'h5383_08; // CMX3 for Y SET_OV5640 + 179: LUT_DATA = 24'h5384_0a; // CMX4 for U SET_OV5640 + 180: LUT_DATA = 24'h5385_7e; // CMX5 for U SET_OV5640 + 181: LUT_DATA = 24'h5386_88; // CMX6 for U SET_OV5640 + 182: LUT_DATA = 24'h5387_7c; // CMX7 for V SET_OV5640 + 183: LUT_DATA = 24'h5388_6c; // CMX8 for V SET_OV5640 + 184: LUT_DATA = 24'h5389_10; // CMX9 for V SET_OV5640 + 185: LUT_DATA = 24'h538a_01; // sign[9] SET_OV5640 + 186: LUT_DATA = 24'h538b_98; // sign[8:1] // UV adjust UV 色彩饱和度调整 SET_OV5640 + 187: LUT_DATA = 24'h5580_06; // saturation on, bit[1] SET_OV5640 + 188: LUT_DATA = 24'h5583_40; SET_OV5640 + 189: LUT_DATA = 24'h5584_10; SET_OV5640 + 190: LUT_DATA = 24'h5589_10; SET_OV5640 + 191: LUT_DATA = 24'h558a_00; SET_OV5640 + 192: LUT_DATA = 24'h558b_f8; SET_OV5640 + 193: LUT_DATA = 24'h501d_40; // enable manual offset of contrast // CIP 锐化和降噪 SET_OV5640 + 194: LUT_DATA = 24'h5300_08; // CIP sharpen MT threshold 1 SET_OV5640 + 195: LUT_DATA = 24'h5301_30; // CIP sharpen MT threshold 2 SET_OV5640 + 196: LUT_DATA = 24'h5302_10; // CIP sharpen MT offset 1 SET_OV5640 + 197: LUT_DATA = 24'h5303_00; // CIP sharpen MT offset 2 SET_OV5640 + 198: LUT_DATA = 24'h5304_08; // CIP DNS threshold 1 SET_OV5640 + 199: LUT_DATA = 24'h5305_30; // CIP DNS threshold 2 SET_OV5640 + 200: LUT_DATA = 24'h5306_08; // CIP DNS offset 1 SET_OV5640 + 201: LUT_DATA = 24'h5307_16; // CIP DNS offset 2 SET_OV5640 + 202: LUT_DATA = 24'h5309_08; // CIP sharpen TH threshold 1 SET_OV5640 + 203: LUT_DATA = 24'h530a_30; // CIP sharpen TH threshold 2 SET_OV5640 + 204: LUT_DATA = 24'h530b_04; // CIP sharpen TH offset 1 SET_OV5640 + 205: LUT_DATA = 24'h530c_06; // CIP sharpen TH offset 2 SET_OV5640 + 206: LUT_DATA = 24'h5025_00; SET_OV5640 + 207: LUT_DATA = 24'h3008_02; // wake up from standby, bit[6] // 800*480, 30fps // input clock 24Mhz, PCLK 91.2MHz //write_i2c(0x3035, 0x21); // PLL_ //write_i2c(0x3a02, 0x12); // 60Hz max exposure, night mode 5fps_ //write_i2c(0x3a03, 0xc6); // 60Hz max exposure_ //write_i2c(0x3a14, 0x12); // 50Hz max exposure, night mode 5fps_ //write_i2c(0x3a15, 0xc6); // 50Hz max exposu SET_OV5640 + 208: LUT_DATA = 24'h3035_21; // PLL 21:30fps 41:15fps 81:7.5fps SET_OV5640 + 209: LUT_DATA = 24'h3036_72; // PLL SET_OV5640 + 210: LUT_DATA = 24'h3c07_08; // lightmeter 1 threshold[7:0] SET_OV5640 + 211: LUT_DATA = 24'h3820_47; // no flip SET_OV5640 + 212: LUT_DATA = 24'h3821_07; // no mirror SET_OV5640 + 213: LUT_DATA = 24'h3814_31; // timing X inc SET_OV5640 + 214: LUT_DATA = 24'h3815_31; // timing Y inc SET_OV5640 + 215: LUT_DATA = 24'h3800_00; // HS SET_OV5640 + 216: LUT_DATA = 24'h3801_00; // HS SET_OV5640 + 217: LUT_DATA = 24'h3802_00; // VS SET_OV5640 + 218: LUT_DATA = 24'h3803_be; // VS SET_OV5640 + 219: LUT_DATA = 24'h3804_0a; // HW SET_OV5640 + : LUT_DATA = HE} SET_OV5640 + 220: LUT_DATA = 24'h3805_3f; // HW SET_OV5640 + : LUT_DATA = HE} SET_OV5640 + 221: LUT_DATA = 24'h3806_06; // VH SET_OV5640 + : LUT_DATA = VE} SET_OV5640 + 222: LUT_DATA = 24'h3807_e4; // VH SET_OV5640 + : LUT_DATA = VE} SET_OV5640 + 223: LUT_DATA = 24'h3808_03; // DVPHO 800 SET_OV5640 + 224: LUT_DATA = 24'h3809_20; // DVPHO SET_OV5640 + 225: LUT_DATA = 24'h380a_01; // DVPVO 480 SET_OV5640 + 226: LUT_DATA = 24'h380b_e0; // DVPVO SET_OV5640 + 227: LUT_DATA = 24'h380c_07; // HTS SET_OV5640 + 228: LUT_DATA = 24'h380d_69; // HTS SET_OV5640 + 229: LUT_DATA = 24'h380e_03; // VTS SET_OV5640 + 230: LUT_DATA = 24'h380f_21; // VTS SET_OV5640 + 231: LUT_DATA = 24'h3813_06; // timing V offset SET_OV5640 + 232: LUT_DATA = 24'h3618_00; SET_OV5640 + 233: LUT_DATA = 24'h3612_29; SET_OV5640 + 234: LUT_DATA = 24'h3709_52; SET_OV5640 + 235: LUT_DATA = 24'h370c_03; SET_OV5640 + 236: LUT_DATA = 24'h3a02_12; // 60Hz max exposure, night mode 5fps 15fps-09 30fps-12 SET_OV5640 + 237: LUT_DATA = 24'h3a03_c6; // 60Hz max exposure 15fps-63 30fps-c6 SET_OV5640 + 238: LUT_DATA = 24'h3a08_00; // SET_OV5640 + 239: LUT_DATA = 24'h3a09_78; // SET_OV5640 + 240: LUT_DATA = 24'h3a0a_00; // SET_OV5640 + 241: LUT_DATA = 24'h3a0b_64; // SET_OV5640 + 242: LUT_DATA = 24'h3a0e_06; // SET_OV5640 + 243: LUT_DATA = 24'h3a0d_08; // SET_OV5640 + 244: LUT_DATA = 24'h3a14_12; // 50Hz max exposure 15fps-09 30fps-12 SET_OV5640 + 245: LUT_DATA = 24'h3a15_c6; // 50Hz max exposure 15fps-63 30fps-c6 SET_OV5640 + 246: LUT_DATA = 24'h4004_02; // BLC line number SET_OV5640 + 247: LUT_DATA = 24'h3002_1c; // reset JFIFO, SFIFO, JPG SET_OV5640 + 248: LUT_DATA = 24'h3006_c3; // disable clock of JPEG2x, JPEG SET_OV5640 + 249: LUT_DATA = 24'h4713_03; // JPEG mode 3 SET_OV5640 + 250: LUT_DATA = 24'h4407_04; // Quantization scale SET_OV5640 + 251: LUT_DATA = 24'h460b_35; SET_OV5640 + 252: LUT_DATA = 24'h460c_22; SET_OV5640 + 253: LUT_DATA = 24'h4837_22; // MIPI global timing SET_OV5640 + 254: LUT_DATA = 24'h3824_02; // PCLK manual divider SET_OV5640 + 255: LUT_DATA = 24'h5001_a3; // SDE on, CMX on, AWB on SET_OV5640 + 256: LUT_DATA = 24'h3503_00; // AEC/AGC on SET_OV5640 + 257: LUT_DATA = 24'h4740_01; // VSYNC 高电平有效----设置信号极性--HREF高电平有效--数据在上升沿输出 /*group3*/ SET_OV5640 + 258: LUT_DATA = 24'h3212_03; //start group3 SET_OV5640 + 259: LUT_DATA = 24'h5580_06; //特效正常 SET_OV5640 + 260: LUT_DATA = 24'h5583_40; SET_OV5640 + 261: LUT_DATA = 24'h5584_10; SET_OV5640 + 262: LUT_DATA = 24'h5003_08; SET_OV5640 + 263: LUT_DATA = 24'h3406_01; //环境光日光 SET_OV5640 + 264: LUT_DATA = 24'h3400_06; SET_OV5640 + 265: LUT_DATA = 24'h3401_1c; SET_OV5640 + 266: LUT_DATA = 24'h3402_04; SET_OV5640 + 267: LUT_DATA = 24'h3403_00; SET_OV5640 + 268: LUT_DATA = 24'h3404_04; SET_OV5640 + 269: LUT_DATA = 24'h3405_f3; SET_OV5640 + 270: LUT_DATA = 24'h5381_1c; //色彩饱和度+2 SET_OV5640 + 271: LUT_DATA = 24'h5382_5a; SET_OV5640 + 272: LUT_DATA = 24'h5383_06; SET_OV5640 + 273: LUT_DATA = 24'h5384_24; SET_OV5640 + 274: LUT_DATA = 24'h5385_8f; SET_OV5640 + 275: LUT_DATA = 24'h5386_b3; SET_OV5640 + 276: LUT_DATA = 24'h5387_b6; SET_OV5640 + 277: LUT_DATA = 24'h5388_b3; SET_OV5640 + 278: LUT_DATA = 24'h5389_03; SET_OV5640 + 279: LUT_DATA = 24'h538b_98; SET_OV5640 + 280: LUT_DATA = 24'h538a_01; SET_OV5640 + 281: LUT_DATA = 24'h5586_28; //对比度+2 SET_OV5640 + 282: LUT_DATA = 24'h5585_18; SET_OV5640 + 283: LUT_DATA = 24'h3212_13; //end group3 SET_OV5640 + 284: LUT_DATA = 24'h3212_a3; //lanuch group3 // SET_OV5640 + 279: LUT_DATA = 24'h5020_2a; // SET_OV5640 + 252: LUT_DATA = 24'h503d_80; // color bar--begin // SET_OV5640 + 253: LUT_DATA = 24'h4741_00; // color bar--end // SET_OV5640 + 260: LUT_DATA = 24'h3016_02; //让strobe 端口使能 // SET_OV5640 + 261: LUT_DATA = 24'h301c_02; //strobe 端口连接了闪光灯 // SET_OV5640 + 262: LUT_DATA = 24'h3019_02; //让strobe 端口为1 // // SET_OV5640 + 263: LUT_DATA = 24'h3016_00; //关闭strobe 端口使能 default : LUT_DATA = 0; endcase end
解决方法是使用1280*720预览,通过配置寄存器缩放输出图像大小到800*480。控制图像缩放输出的寄存器配置如上,此时PCLK为82MHz。
使用的是小梅哥的ACM5640_V2模块,自己在后面增加了一些特效(增加对比度和饱和度),最终显示效果如下: