camera sensor i2c数据传输时序及其分析

 以上时序摘自镁光的一款camera sensor.

1写模式:

 

首先开始信号,主机发送从机地址(0-7位)/写(第8位),等待从机发送ACK信号,应答之后发送word16位的消息为sensor寄存器地址,分八位传输中间有ACK信号。同理接着发送16位value对应刚才寄存器地址。(见下面源码)

 

static int mt9t013_i2c_write_w(unsigned short saddr,
       unsigned short waddr, unsigned short wdata)
{
 int rc = -EIO;
 unsigned char buf[4];

 memset(buf, 0, sizeof(buf));
 buf[0] = (waddr & 0xFF00) >> 8;
 buf[1] = (waddr & 0x00FF);
 buf[2] = (wdata & 0xFF00) >> 8;
 buf[3] = (wdata & 0x00FF);

 rc = mt9t013_i2c_txdata(saddr, buf, 4);

 if (rc < 0)
  pr_err("i2c_write_w failed, addr = 0x%x, val = 0x%x!\n",
         waddr, wdata);

 return rc;
}

 

2读模式:

 

和写模式一样 先addr后data.见上图。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值