I have a new board with BF524 that contains a device that uses 16-bit addresses for its registers.
Does u-boot for BF524 support 16-bit addressing for I2C?
Yes, please see "help i2c".
I'm looking at the I2C functions and I don't see that it supports what I need to do.
I need to write 0x20 to
I2C address = 0x1A
I2C register = 0x1AB6
When I look in .\u-boot-2012.07-rc2-2012R2-RC3\include\i2c.h, it appears the prototype only supports 8-bit registers:
static inline void i2c_reg_write(u8 addr, u8 reg, u8 val)
Is there a way to do this write, either in the code or the command interface?
Run help i2c in u-boot console says:
bfin> help i2c
i2c - I2C sub-system
i2c crc32 chip address[.0, .1, .2] count - compute CRC32 checksum
i2c loop chip address[.0, .1, .2] [# of objects] - looping read of device
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 probe - show devices on the I2C bus
i2c read chip address[.0, .1, .2] length memaddress - read to memory
i2c reset - re-init the I2C Controller
i2c speed [speed] - show or set I2C bus speed
Together with the long comments and example in file common/cmd_i2c.c, are you able to solve your problem?
The instructions above are not clear. I spent over an hour trying different commands and was not able to figure this out.
Can you please provide the command that will set I2C address 0x1A, register 0x1AB6 to 0x20?
Also, please provide the command that I can use to read this value back (to verify it.)
Hi Matt, there is more information https://docs.blackfin.uclinux.org/doku.php?id=bootloaders:u-boot:i2c
I think I figured out the command syntax and what was happening on I2C. I have sent you a private email to discuss further.
I figured out that the device/chip address must be entered as a 7-bit address (so 0x1A must be entered as 0x0D). More on that here: http://www.diolan.com/dln_doc/i2c-address.html.
Furthermore, the offset/address comes out in reverse order from what I expected. For example, 1AB6.2 causes 0xB6 and then 0x1A to be transmitted on the I2C bus.
Therefore, the command to set 0x1A 0x1AB6 to 0x20 is:
i2c mw 0d b61a.2 20 1
The command to read this register back (to verify) is:
i2c md 0d b61a.2 1
Thanks for your assistance!
Retrieving data ...