OV5640(1)--上电时序要求

文章详细描述了如何在FPGA中实现OV5640摄像头传感器的上电时序控制,包括DVDD对PWDN、PWDN对RESETB、以及RESETB对SCCB的延迟时间设置,通过使用计数器和信号状态管理确保满足OV5640的特定时序要求。
摘要由CSDN通过智能技术生成

OV5640 有上电时序的要求,FPGA 上电后需要等待一段时间再使能配置 OV5640 寄存器,那么怎么满足其上电时序的要求呢?且看下图:
在这里插入图片描述
在这里插入图片描述
此图描述了OV5640上电时序中对各信号的要求,归纳如下:

t0>=0ms:DOVDD要比AVDD提前稳定的时间
t1>=0ms:AVDD要比DVDD提前稳定的时间
t2>=5ms:DVDD要比PWDN(传感器上电)提前稳定的时间
t3>=1ms:PWDN(传感器上电)要比RESETB提前稳定的时间
t4>=20ms:RESETB要比SCCB提前稳定的时间
t5>=0ms:AVDD要比DOVDD延后关断的时间
t6>=0ms:RESETB要比DVDD延后关断的时间
t7>=0ms:XVCLK要比DVDD延后关断的时间

能等于0的我们都不关注,所以要设置的值就只剩3个:

t2>=5ms:DVDD要比PWDN(传感器上电)提前稳定的时间
t3>=1ms:PWDN(传感器上电)要比RESETB提前稳定的时间
t4>=20ms:RESETB要比SCCB提前稳定的时间

我们这里分别设置成6ms,2ms,21ms

三个标志信号
camera_pwnd_reg___|~~|____

camera_rstn_reg_______|~~|_____

initial_en ________________ |~~|_____

当前一个信号有效时,下一个信号清零做准备

//6ms, delay from sensor power up stable to Pwdn pull down
always@(posedge clk_50M)//20ns
begin
  if(reset_n==1'b0) begin
	    cnt1<=0;
		 camera_pwnd_reg<=1'b1;  
  end
  else if(cnt1<19'h493e0) begin
       cnt1<=cnt1+1'b1;
       camera_pwnd_reg<=1'b1;
  end
  else
     camera_pwnd_reg<=1'b0;         
end

同理,2ms,21ms的延时如下:
2ms:

//2ms, delay from pwdn low to resetb pull up
always@(posedge clk_50M)//20ns
begin
  if(camera_pwnd_reg==1)  begin
	    cnt2<=0;
		 camera_rstn_reg<=1'b0;  
  end
  else if(cnt2<17'h186A0) begin
       cnt2<=cnt2+1'b1;
       camera_rstn_reg<=1'b0;
  end
  else
     camera_rstn_reg<=1'b1;         
end

21ms:

//21ms, delay from resetb pul high to SCCB initialization
always@(posedge clk_50M)
begin
  if(camera_rstn_reg==0) begin
         cnt3<=0;
         initial_en<=1'b0;
  end
  else if(cnt3<21'h100590) begin
        cnt3<=cnt3+1'b1;
        initial_en<=1'b0;
  end
  else
       initial_en<=1'b1;    
end

总的上电程序如下:

//camera power on timing requirement
module power_on_delay(clk_50M,reset_n,camera_rstn,camera_pwnd,initial_en);                  
input clk_50M;
input reset_n;
output camera_rstn;
output camera_pwnd;
output initial_en;
reg [18:0]cnt1;
reg [15:0]cnt2;
reg [19:0]cnt3;
reg initial_en;
reg camera_rstn_reg;
reg camera_pwnd_reg;

assign camera_rstn=camera_rstn_reg;
assign camera_pwnd=camera_pwnd_reg;

//6ms, delay from sensor power up stable to Pwdn pull down
always@(posedge clk_50M)//20ns
begin
  if(reset_n==1'b0) begin
	    cnt1<=0;
		 camera_pwnd_reg<=1'b1;  
  end
  else if(cnt1<19'h493e0) begin
       cnt1<=cnt1+1'b1;
       camera_pwnd_reg<=1'b1;
  end
  else
     camera_pwnd_reg<=1'b0;         
end

//2ms, delay from pwdn low to resetb pull up
always@(posedge clk_50M)//20ns
begin
  if(camera_pwnd_reg==1)  begin
	    cnt2<=0;
		 camera_rstn_reg<=1'b0;  
  end
  else if(cnt2<17'h186A0) begin
       cnt2<=cnt2+1'b1;
       camera_rstn_reg<=1'b0;
  end
  else
     camera_rstn_reg<=1'b1;         
end

//21ms, delay from resetb pul high to SCCB initialization
always@(posedge clk_50M)
begin
  if(camera_rstn_reg==0) begin
         cnt3<=0;
         initial_en<=1'b0;
  end
  else if(cnt3<21'h100590) begin
        cnt3<=cnt3+1'b1;
        initial_en<=1'b0;
  end
  else
       initial_en<=1'b1;    
end
endmodule

完成!

  • 20
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值