在嵌入式中,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