linux 读写i2c设备,U-Boot下的I2C设备的读写

在嵌入式中,I2C设备的使用比较广泛,U-Boot集成了i2c的操作函数及命令。如下

mpc8349@MITC> help i2c

i2c speed [speed] - show or set I2C bus speed

i2c dev [dev] - show or set current I2C bus

i2c md chip address[.0, .1, .2] [# of objects] - read from I2C device

i2c mm chip address[.0, .1, .2] - write to I2C device (auto-incrementing)

i2c mw chip address[.0, .1, .2] value [count] - write to I2C device (fill)

i2c nm chip address[.0, .1, .2] - write to I2C device (constant address)

i2c crc32 chip address[.0, .1, .2] count - compute CRC32 checksum

i2c probe - show devices on the I2C bus

i2c reset - re-init the I2C Controller

i2c loop chip address[.0, .1, .2] [# of objects] - looping read of device

i2c sdram chip - print SDRAM configuration information

mpc8349@MITC> i2c dev   // 查看当前的i2c总线

Current bus is 1

mpc8349@MITC> iprobe   // i2c设备地址探测

Valid chip addresses: 51 68

Excluded chip addresses: 20 21 38 39

mpc8349@MITC> imd 0x51 0.0  // 读i2c设备

0000: 08 07 0d 0a 01 40 00 04 50 70 00 82 10 00 01 0e    [email protected]......

Freescale的PowerPC芯片MPC8349E内部集成了两个i2c控制器,在MPC8349E-mITX开发板中用控制器I2C1连接M24256-BWMN6P

(i2c eeprom芯片,256kB大小),用I2C2连接了PCF8574(0x20, 0x21), DS1339U-33 RTC(0x39), DDR SPD eeprom(0x51)等。

其中M2

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值