赞
踩
OV5640使用寄存器0x3800 ~ 0x3814来配置图像窗口。
physical pixel size(最大为2632 * 1951)是传感器中的总像素阵列大小。
ISP input size(最大为2592 * 1944)是从像素数组中读取的总像素数据。
最终的data output size(输出窗口大小),也就是需要的分辨率是由{0x3808,0x3809}和{0x380A ,0x380B}决定的,这也是我们最终输出到显示器的图像大小。
表中列出了几种参考的数据速率,但其本身支持2592 * 1944大小之下的任意分辨率,所以除了列出的这几种常用配置外,具体传输速率无法真正确定。
传输速率是配置完成后就固定下来的参数,不可在FPGA(主机端)更改,只能用于计算总线带宽是否足够。
OV5640的寄存器非常多,但是很多参数我们不用配置,直接使用默认值即可,唯一需要我们做的是配置输出窗的大小,用以适配我们后面的设计。
这里给出两种常用的配置(1920*1080
和 1280*720
),其他保持默认的参数会在下方的完整代码中给出。
- //1920*1080
- write_i2c(0x3800 ,0x01);
- write_i2c(0x3801 ,0x50);
- write_i2c(0x3802 ,0x01);
- write_i2c(0x3803 ,0xb2);
- write_i2c(0x3804 ,0x08);
- write_i2c(0x3805 ,0xef);
- write_i2c(0x3806 ,0x05);
- write_i2c(0x3807 ,0xf2);
- write_i2c(0x3808 ,0x07);
- write_i2c(0x3809 ,0x80);
- write_i2c(0x380a ,0x04);
- write_i2c(0x380b ,0x38);
- write_i2c(0x380c ,0x09);
- write_i2c(0x380d ,0xc4);
- write_i2c(0x380e ,0x04);
- write_i2c(0x380f ,0x60);
- write_i2c(0x3810 ,0x00);
- write_i2c(0x3811 ,0x10);
- write_i2c(0x3812 ,0x00);
- write_i2c(0x3813 ,0x04);
- //1280*720
- write_i2c(0x3800 ,0x00);
- write_i2c(0x3801 ,0x00);
- write_i2c(0x3802 ,0x00);
- write_i2c(0x3803 ,0xfa);
- write_i2c(0x3804 ,0x0a);
- write_i2c(0x3805 ,0x3f);
- write_i2c(0x3806 ,0x06);
- write_i2c(0x3807 ,0xa9);
- write_i2c(0x3808 ,0x05);
- write_i2c(0x3809 ,0x00);
- write_i2c(0x380a ,0x02);
- write_i2c(0x380b ,0xd0);
- write_i2c(0x380c ,0x07);
- write_i2c(0x380d ,0x64);
- write_i2c(0x380e ,0x02);
- write_i2c(0x380f ,0xe4);
- write_i2c(0x3810 ,0x00);
- write_i2c(0x3811 ,0x10);
- write_i2c(0x3812 ,0x00);
- write_i2c(0x3813 ,0x04);
这一流程可分为4个阶段:上电等待、软复位、复位等待、配置所有寄存器。
下面两张图可以得出,上电等待的时间为26ms(实际上25ms也是可以的),软复位的等待时间为1ms。
实际上,在已经有接口模块的现在(I2C接口模块),控制模块要做的事情就很简单了,发送请求、命令和要发送的数据。
- localparam IDLE = 5'b00001,
- CMD = 5'b00010,
- SEND = 5'b00100,
- WAIT = 5'b01000,
- DONE = 5'b10000;
这个状态机非常单薄,所以只做简单阐述:
IDLE:空闲状态
CMD:这一状态是为了让这个模块更稳定而设置的,负责的是命令和数据的改变,不发送数据
SEND:这一状态只负责发送命令、数据、请求给接口模块,命令和数据的改变不在此状态执行
WAIT:用于处理上电和软复位的等待
DONE:给更上层的模块发送初始化结束信号
这一代码非常长,但本身很简单,主要长在要配置的寄存器极多。这一代码直接使用,涉及到的参数只有4个,一并贴出:
- //所用参数
- `define START_CMD 4'b0001
- `define WRITE_CMD 4'b0010
- `define READ_CMD 4'b0100
- `define STOP_CMD 4'b1000
- //原本参数是写在param.v里,使用时可以自己新建一个param.v文件,或者把这些参数放进来即可
- //模块本体
- `include "param.v"
-
- module ov5640_cfg
- (
- input clk ,
- input rst_n ,
-
- output i2c_start ,
- output [7:0] i2c_data_out,
- output [3:0] i2c_cmd ,
-
- input [7:0] dout ,
- input i2c_end ,
-
- output initial_done
- );
- parameter CMD_NUM = 256;
- parameter BYTE_NUM = 4;
- parameter TIME_25MS = 1_250_000;
- parameter TIME_2MS = 100_000;
-
- reg i2c_start_r ;
- reg [7:0] i2c_data_out_r;
- reg [3:0] i2c_cmd_r ;
- reg initial_done_r;
-
- reg [20:0] cnt_delay_num;
- reg [20:0] cnt_delay; //最大计到1_250_000,即25ms
- wire add_cnt_delay,
- end_cnt_delay;
-
- reg [3:0] cnt_send;
- wire add_cnt_send,
- end_cnt_send;
-
- reg [9:0] cnt_cmd; //逐条发送命令及数据
- wire add_cnt_cmd,
- end_cnt_cmd;
-
- reg start_flag0,
- start_flag1;
-
- reg [23:0] addr_data;
-
- //状态机参数定义
- localparam IDLE = 5'b00001,
- CMD = 5'b00010,
- SEND = 5'b00100,
- WAIT = 5'b01000,
- DONE = 5'b10000;
-
- reg [4:0] state_c,
- state_n;
-
- wire idle2cmd ,
- cmd2wait ,
- cmd2send ,
- wait2cmd ,
- send2cmd ,
- cmd2done ,
- done2idle;
-
- //状态机状态跳转
- always@(posedge clk or negedge rst_n)begin
- if(!rst_n)
- state_c <= IDLE;
- else
- state_c <= state_n;
- end
-
- always@(*)begin
- case(state_c)
- IDLE:begin
- if(idle2cmd)
- state_n = CMD;
- else
- state_n = state_c;
- end
- CMD :begin
- if(cmd2wait)
- state_n = WAIT;
- else if(cmd2send)
- state_n = SEND;
- else if(cmd2done)
- state_n = DONE;
- else
- state_n = state_c;
- end
- SEND:begin
- if(send2cmd)
- state_n = CMD;
- else
- state_n = state_c;
- end
- WAIT:begin
- if(wait2cmd)
- state_n = CMD;
- else
- state_n = state_c;
- end
- DONE:begin
- if(done2idle)
- state_n = IDLE;
- else
- state_n = state_c;
- end
- default: state_n = IDLE;
- endcase
- end
-
- assign idle2cmd = (state_c == IDLE) && (~start_flag1);
- assign cmd2wait = (state_c == CMD ) && ((cnt_cmd == 0) || (cnt_cmd == 3));
- assign cmd2send = (state_c == CMD ) && (~end_cnt_cmd) && (~(cnt_cmd == 0) || (cnt_cmd == 3));
- assign wait2cmd = (state_c == WAIT) && (end_cnt_delay);
- assign send2cmd = (state_c == SEND) && (end_cnt_send);
- assign cmd2done = (state_c == CMD ) && (end_cnt_cmd);
- assign done2idle = (state_c == DONE) && (1'b1);
-
- //计数器
- always@(posedge clk or negedge rst_n)begin
- if(!rst_n)
- cnt_delay <= 1'b0;
- else if(add_cnt_delay)
- if(end_cnt_delay)
- cnt_delay <= 1'b0;
- else
- cnt_delay <= cnt_delay + 1'b1;
- else
- cnt_delay <= cnt_delay;
- end
- assign add_cnt_delay = (state_c == WAIT);
- assign end_cnt_delay = add_cnt_delay && cnt_delay >= cnt_delay_num - 1'b1;
-
- always@(*)begin
- if(cnt_cmd == 0)
- cnt_delay_num = TIME_25MS;
- else if(cnt_cmd == 3)
- cnt_delay_num = TIME_2MS;
- else
- cnt_delay_num = cnt_delay_num;
- end
-
- always@(posedge clk or negedge rst_n)begin
- if(!rst_n)
- cnt_cmd <= 1'b0;
- else if(add_cnt_cmd)
- if(end_cnt_cmd)
- cnt_cmd <= 1'b0;
- else
- cnt_cmd <= cnt_cmd + 1'b1;
- else
- cnt_cmd <= cnt_cmd;
- end
- assign add_cnt_cmd = (state_c == CMD);
- assign end_cnt_cmd = add_cnt_cmd && cnt_cmd >= CMD_NUM - 1'b1;
-
- always@(posedge clk or negedge rst_n)begin
- if(!rst_n)
- cnt_send <= 1'b0;
- else if(add_cnt_send)
- if(end_cnt_send)
- cnt_send <= 1'b0;
- else
- cnt_send <= cnt_send + 1'b1;
- else
- cnt_send <= cnt_send;
- end
- assign add_cnt_send = (state_c == SEND) && i2c_end;
- assign end_cnt_send = add_cnt_send && cnt_send >= BYTE_NUM - 1'b1;
-
- //启动信号
- always@(posedge clk or negedge rst_n)begin
- if(!rst_n) begin
- start_flag0 <= 1'b0;
- start_flag1 <= 1'b0;
- end
- else begin
- start_flag0 <= 1'b1;
- start_flag1 <= start_flag0;
- end
- end
-
- //输出控制
- always@(*)begin
- if(state_n == SEND)
- case(cnt_send)
- 'd0:TX(1'b1,`START_CMD|`WRITE_CMD,8'h78);
- 'd1:TX(1'b1,`WRITE_CMD,addr_data[23:16]);
- 'd2:TX(1'b1,`WRITE_CMD,addr_data[15: 8]);
- 'd3:TX(1'b1,`WRITE_CMD|`STOP_CMD,addr_data[7 : 0]);
- default: TX(1'b0,4'd0,8'd0);
- endcase
- else
- TX(1'b0,4'd0,8'd0);
- end
-
- always@(posedge clk or negedge rst_n)begin
- if(!rst_n)
- initial_done_r <= 1'b0;
- else if(state_c == DONE)
- initial_done_r <= 1'b1;
- else
- initial_done_r <= initial_done_r;
- end
-
- assign initial_done = initial_done_r;
-
- //命令集
- always@(*)begin
- case(cnt_cmd)
- //15fps VGA output
- // 24MHz input clock, 84MHz PCLK
- 0 : addr_data = 0; //power_on wait time
- 1 : addr_data = {24'h3103_11}; // system clock from pad, bit[1]
- 2 : addr_data = {24'h3008_82}; // software reset, bit[7]
- 3 : addr_data = 0; //software reset wait time
- 4 : addr_data = {24'h3008_42}; // software power down, bit[6]
- 5 : addr_data = {24'h3103_03}; // system clock from PLL, bit[1]
- 6 : addr_data = {24'h3017_ff}; // FREX, Vsync, HREF, PCLK, D[9:6] output enable
- 7 : addr_data = {24'h3018_ff}; // D[5:0], GPIO[1:0] output enable
- 8 : addr_data = {24'h3034_1a}; // MIPI 10-bit
- 9 : addr_data = {24'h3037_13}; // PLL root divider, bit[4], PLL pre-divider, bit[3:0]
- 10 : addr_data = {24'h3108_01}; // PCLK root divider, bit[5:4], SCLK2x root divider, bit[3:2]
- 11 : addr_data = {24'h3630_36}; //SCLK root divider, bit[1:0]
- 12 : addr_data = {24'h3631_0e};
- 13 : addr_data = {24'h3632_e2};
- 14 : addr_data = {24'h3633_12};
- 15 : addr_data = {24'h3621_e0};
- 16 : addr_data = {24'h3704_a0};
- 17 : addr_data = {24'h3703_5a};
- 18 : addr_data = {24'h3715_78};
- 19 : addr_data = {24'h3717_01};
- 20 : addr_data = {24'h370b_60};
- 21 : addr_data = {24'h3705_1a};
- 22 : addr_data = {24'h3905_02};
- 23 : addr_data = {24'h3906_10};
- 24 : addr_data = {24'h3901_0a};
- 25 : addr_data = {24'h3731_12};
- 26 : addr_data = {24'h3600_08}; // VCM control
- 27 : addr_data = {24'h3601_33}; // VCM control
- 28 : addr_data = {24'h302d_60}; // system control
- 29 : addr_data = {24'h3620_52};
- 30 : addr_data = {24'h371b_20};
- 31 : addr_data = {24'h471c_50};
- 32 : addr_data = {24'h3a13_43}; // pre-gain = 1.047x
- 33 : addr_data = {24'h3a18_00}; // gain ceiling
- 34 : addr_data = {24'h3a19_f8}; // gain ceiling = 15.5x
- 35 : addr_data = {24'h3635_13};
- 36 : addr_data = {24'h3636_03};
- 37 : addr_data = {24'h3634_40};
- 38 : addr_data = {24'h3622_01};
- // 50/60Hz detection 50/60Hz 灯光条纹过滤
- 39 : addr_data = {24'h3c01_34}; // Band auto, bit[7]
- 40 : addr_data = {24'h3c04_28}; // threshold low sum
- 41 : addr_data = {24'h3c05_98}; // threshold high sum
- 42 : addr_data = {24'h3c06_00}; // light meter 1 threshold[15:8]
- 43 : addr_data = {24'h3c07_08}; // light meter 1 threshold[7:0]
- 44 : addr_data = {24'h3c08_00}; // light meter 2 threshold[15:8]
- 45 : addr_data = {24'h3c09_1c}; // light meter 2 threshold[7:0]
- 46 : addr_data = {24'h3c0a_9c}; // sample number[15:8]
- 47 : addr_data = {24'h3c0b_40}; // sample number[7:0]
- 48 : addr_data = {24'h3810_00}; // Timing Hoffset[11:8]
- 49 : addr_data = {24'h3811_10}; // Timing Hoffset[7:0]
- 50 : addr_data = {24'h3812_00}; // Timing Voffset[10:8]
- 51 : addr_data = {24'h3708_64};
- 52 : addr_data = {24'h4001_02}; // BLC start from line 2
- 53 : addr_data = {24'h4005_1a}; // BLC always update
- 54 : addr_data = {24'h3000_00}; // enable blocks
- 55 : addr_data = {24'h3004_ff}; // enable clocks
- 56 : addr_data = {24'h300e_58}; //MIPI power down,DVP enable
- 57 : addr_data = {24'h302e_00};
- 58 : addr_data = {24'h4300_61}; // RGB,
- 59 : addr_data = {24'h501f_01}; // ISP RGB
- 60 : addr_data = {24'h440e_00};
- 61 : addr_data = {24'h5000_a7}; // Lenc on, raw gamma on, BPC on, WPC on, CIP on
- // AEC target 自动曝光控制
- 62 : addr_data = {24'h3a0f_30}; // stable range in high
- 63 : addr_data = {24'h3a10_28}; // stable range in low
- 64 : addr_data = {24'h3a1b_30}; // stable range out high
- 65 : addr_data = {24'h3a1e_26}; // stable range out low
- 66 : addr_data = {24'h3a11_60}; // fast zone high
- 67 : addr_data = {24'h3a1f_14}; // fast zone low
- // Lens correction for ? 镜头补偿
- 68 : addr_data = {24'h5800_23};
- 69 : addr_data = {24'h5801_14};
- 70 : addr_data = {24'h5802_0f};
- 71 : addr_data = {24'h5803_0f};
- 72 : addr_data = {24'h5804_12};
- 73 : addr_data = {24'h5805_26};
- 74 : addr_data = {24'h5806_0c};
- 75 : addr_data = {24'h5807_08};
- 76 : addr_data = {24'h5808_05};
- 77 : addr_data = {24'h5809_05};
- 78 : addr_data = {24'h580a_08};
- 79 : addr_data = {24'h580b_0d};
- 80 : addr_data = {24'h580c_08};
- 81 : addr_data = {24'h580d_03};
- 82 : addr_data = {24'h580e_00};
- 83 : addr_data = {24'h580f_00};
- 84 : addr_data = {24'h5810_03};
- 85 : addr_data = {24'h5811_09};
- 86 : addr_data = {24'h5812_07};
- 87 : addr_data = {24'h5813_03};
- 88 : addr_data = {24'h5814_00};
- 89 : addr_data = {24'h5815_01};
- 90 : addr_data = {24'h5816_03};
- 91 : addr_data = {24'h5817_08};
- 92 : addr_data = {24'h5818_0d};
- 93 : addr_data = {24'h5819_08};
- 94 : addr_data = {24'h581a_05};
- 95 : addr_data = {24'h581b_06};
- 96 : addr_data = {24'h581c_08};
- 97 : addr_data = {24'h581d_0e};
- 98 : addr_data = {24'h581e_29};
- 99 : addr_data = {24'h581f_17};
- 100 : addr_data = {24'h5820_11};
- 101 : addr_data = {24'h5821_11};
- 102 : addr_data = {24'h5822_15};
- 103 : addr_data = {24'h5823_28};
- 104 : addr_data = {24'h5824_46};
- 105 : addr_data = {24'h5825_26};
- 106 : addr_data = {24'h5826_08};
- 107 : addr_data = {24'h5827_26};
- 108 : addr_data = {24'h5828_64};
- 109 : addr_data = {24'h5829_26};
- 110 : addr_data = {24'h582a_24};
- 111 : addr_data = {24'h582b_22};
- 112 : addr_data = {24'h582c_24};
- 113 : addr_data = {24'h582d_24};
- 114 : addr_data = {24'h582e_06};
- 115 : addr_data = {24'h582f_22};
- 116 : addr_data = {24'h5830_40};
- 117 : addr_data = {24'h5831_42};
- 118 : addr_data = {24'h5832_24};
- 119 : addr_data = {24'h5833_26};
- 120 : addr_data = {24'h5834_24};
- 121 : addr_data = {24'h5835_22};
- 122 : addr_data = {24'h5836_22};
- 123 : addr_data = {24'h5837_26};
- 124 : addr_data = {24'h5838_44};
- 125 : addr_data = {24'h5839_24};
- 126 : addr_data = {24'h583a_26};
- 127 : addr_data = {24'h583b_28};
- 128 : addr_data = {24'h583c_42};
- 129 : addr_data = {24'h583d_ce}; // lenc BR offset
- // AWB 自动白平衡
- 130 : addr_data = {24'h5180_ff}; // AWB B block
- 131 : addr_data = {24'h5181_f2}; // AWB control
- 132 : addr_data = {24'h5182_00}; // [7:4] max local counter, [3:0] max fast counter
- 133 : addr_data = {24'h5183_14}; // AWB advanced
- 134 : addr_data = {24'h5184_25};
- 135 : addr_data = {24'h5185_24};
- 136 : addr_data = {24'h5186_09};
- 137 : addr_data = {24'h5187_09};
- 138 : addr_data = {24'h5188_09};
- 139 : addr_data = {24'h5189_75};
- 140 : addr_data = {24'h518a_54};
- 141 : addr_data = {24'h518b_e0};
- 142 : addr_data = {24'h518c_b2};
- 143 : addr_data = {24'h518d_42};
- 144 : addr_data = {24'h518e_3d};
- 145 : addr_data = {24'h518f_56};
- 146 : addr_data = {24'h5190_46};
- 147 : addr_data = {24'h5191_f8}; // AWB top limit
- 148 : addr_data = {24'h5192_04}; // AWB bottom limit
- 149 : addr_data = {24'h5193_70}; // red limit
- 150 : addr_data = {24'h5194_f0}; // green limit
- 151 : addr_data = {24'h5195_f0}; // blue limit
- 152 : addr_data = {24'h5196_03}; // AWB control
- 153 : addr_data = {24'h5197_01}; // local limit
- 154 : addr_data = {24'h5198_04};
- 155 : addr_data = {24'h5199_12};
- 156 : addr_data = {24'h519a_04};
- 157 : addr_data = {24'h519b_00};
- 158 : addr_data = {24'h519c_06};
- 159 : addr_data = {24'h519d_82};
- 160 : addr_data = {24'h519e_38}; // AWB control
- // Gamma 伽玛曲线
- 161 : addr_data = {24'h5480_01}; //Gamma bias plus on, bit[0]
- 162 : addr_data = {24'h5481_08};
- 163 : addr_data = {24'h5482_14};
- 164 : addr_data = {24'h5483_28};
- 165 : addr_data = {24'h5484_51};
- 166 : addr_data = {24'h5485_65};
- 167 : addr_data = {24'h5486_71};
- 168 : addr_data = {24'h5487_7d};
- 169 : addr_data = {24'h5488_87};
- 170 : addr_data = {24'h5489_91};
- 171 : addr_data = {24'h548a_9a};
- 172 : addr_data = {24'h548b_aa};
- 173 : addr_data = {24'h548c_b8};
- 174 : addr_data = {24'h548d_cd};
- 175 : addr_data = {24'h548e_dd};
- 176 : addr_data = {24'h548f_ea};
- 177 : addr_data = {24'h5490_1d};
- // color matrix 色彩矩阵
- 178 : addr_data = {24'h5381_1e}; // CMX1 for Y
- 179 : addr_data = {24'h5382_5b}; // CMX2 for Y
- 180 : addr_data = {24'h5383_08}; // CMX3 for Y
- 181 : addr_data = {24'h5384_0a}; // CMX4 for U
- 182 : addr_data = {24'h5385_7e}; // CMX5 for U
- 183 : addr_data = {24'h5386_88}; // CMX6 for U
- 184 : addr_data = {24'h5387_7c}; // CMX7 for V
- 185 : addr_data = {24'h5388_6c}; // CMX8 for V
- 186 : addr_data = {24'h5389_10}; // CMX9 for V
- 187 : addr_data = {24'h538a_01}; // sign[9]
- 188 : addr_data = {24'h538b_98}; // sign[8:1]
- // UV adjust UV 色彩饱和度调整
- 189 : addr_data = {24'h5580_06}; // saturation on, bit[1]
- 190 : addr_data = {24'h5583_40};
- 191 : addr_data = {24'h5584_10};
- 192 : addr_data = {24'h5589_10};
- 193 : addr_data = {24'h558a_00};
- 194 : addr_data = {24'h558b_f8};
- 195 : addr_data = {24'h501d_40}; // enable manual offset of contrast
- // CIP 锐化和降噪
- 196 : addr_data = {24'h5300_08}; //CIP sharpen MT threshold 1
- 197 : addr_data = {24'h5301_30}; //CIP sharpen MT threshold 2
- 198 : addr_data = {24'h5302_10}; // CIP sharpen MT offset 1
- 199 : addr_data = {24'h5303_00}; // CIP sharpen MT offset 2
- 200 : addr_data = {24'h5304_08}; // CIP DNS threshold 1
- 201 : addr_data = {24'h5305_30}; // CIP DNS threshold 2
- 202 : addr_data = {24'h5306_08}; // CIP DNS offset 1
- 203 : addr_data = {24'h5307_16}; // CIP DNS offset 2
- 204 : addr_data = {24'h5309_08}; //CIP sharpen TH threshold 1
- 205 : addr_data = {24'h530a_30}; //CIP sharpen TH threshold 2
- 206 : addr_data = {24'h530b_04}; //CIP sharpen TH offset 1
- 207 : addr_data = {24'h530c_06}; //CIP sharpen TH offset 2
- 208 : addr_data = {24'h5025_00};
- 209 : addr_data = {24'h3008_02}; //wake up from standby,bit[6]
- // input clock 24Mhz, PCLK 84Mhz
- 210 : addr_data = {24'h3035_21}; // PLL
- 211 : addr_data = {24'h3036_69}; // PLL
- 212 : addr_data = {24'h3c07_07}; // lightmeter 1 threshold[7:0]
- 213 : addr_data = {24'h3820_47}; // flip
- 214 : addr_data = {24'h3821_01}; // no mirror
- 215 : addr_data = {24'h3814_31}; // timing X inc
- 216 : addr_data = {24'h3815_31}; // timing Y inc
-
- 217 : addr_data = {24'h3800_00}; // HS
- 218 : addr_data = {24'h3801_00}; // HS start from 0
- 219 : addr_data = {24'h3802_00}; // VS
- 220 : addr_data = {24'h3803_fa}; // VS start from 250
- 221 : addr_data = {24'h3804_0a}; // HW
- 222 : addr_data = {24'h3805_3f}; // HW end at 2623
- 223 : addr_data = {24'h3806_06}; // VH
- 224 : addr_data = {24'h3807_a9}; // VH end at 1705
- 225 : addr_data = {24'h3808_05}; // DVPHO 1280
- 226 : addr_data = {24'h3809_00}; // DVPHO
- 227 : addr_data = {24'h380a_02}; // DVPVO 720
- 228 : addr_data = {24'h380b_d0}; // DVPVO
- 229 : addr_data = {24'h380c_07}; // HTS
- 230 : addr_data = {24'h380d_64}; // HTS total 1892
- 231 : addr_data = {24'h380e_02}; // VTS
- 232 : addr_data = {24'h380f_e4}; // VTS total 740
- 233 : addr_data = {24'h3813_04}; // timing V offset
-
- 234 : addr_data = {24'h3618_00};
- 235 : addr_data = {24'h3612_29};
- 236 : addr_data = {24'h3709_52};
- 237 : addr_data = {24'h370c_03};
- 238 : addr_data = {24'h3a02_02}; // 60Hz max exposure
- 239 : addr_data = {24'h3a03_e0}; // 60Hz max exposure
- 240 : addr_data = {24'h3a14_02}; // 50Hz max exposure
- 241 : addr_data = {24'h3a15_e0}; // 50Hz max exposure
- 242 : addr_data = {24'h4004_02}; // BLC line number
- 243 : addr_data = {24'h3002_1c}; // reset JFIFO, SFIFO, JPG
- 244 : addr_data = {24'h3006_c3}; // disable clock of JPEG2x, JPEG
- 245 : addr_data = {24'h4713_03}; // JPEG mode 3
- 246 : addr_data = {24'h4407_04}; // Quantization scale
- 247 : addr_data = {24'h460b_37};
- 248 : addr_data = {24'h460c_20};
- 249 : addr_data = {24'h4837_16}; // MIPI global timing
- 250 : addr_data = {24'h3824_04}; // PCLK manual divider
- 251 : addr_data = {24'h5001_83}; // SDE on, CMX on, AWB on
- 252 : addr_data = {24'h3503_00}; // AEC/AGC on
- 253 : addr_data = {24'h4740_20}; // VS 1
- 254 : addr_data = {24'h503d_80}; // color bar
- 255 : addr_data = {24'h4741_00}; //
- default : addr_data = 0;
- endcase
- end
-
- //数据发送task
- task TX;
- input req;
- input [3:0] cmd;
- input [7:0] data;
- begin
- i2c_start_r = req;
- i2c_cmd_r = cmd;
- i2c_data_out_r = data;
- end
- endtask
-
- assign i2c_start = i2c_start_r;
- assign i2c_cmd = i2c_cmd_r;
- assign i2c_data_out = i2c_data_out_r;
-
- endmodule
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。