Skip to content

Instantly share code, notes, and snippets.

@sr105
Created June 5, 2015 15:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sr105/e9bbf4e4865902149f69 to your computer and use it in GitHub Desktop.
Save sr105/e9bbf4e4865902149f69 to your computer and use it in GitHub Desktop.
U-Boot read an I2C register into an environment variable
#### Demo Commands
mw.b ${loadaddr} 0 10
md.b ${loadaddr} 10
i2c bus 0
i2c read 0x51 0xDF.1 1 $loadaddr
md.b ${loadaddr} 10
setexpr.b recovery *$loadaddr
echo $recovery
#### Actual necessary commands: (is "i2c bus 0" necessary?)
i2c bus 0
i2c read 0x51 0xDF.1 1 $loadaddr
setexpr.b recovery *$loadaddr
#### Demo (note: I previously set the I2C register to 0x13)
Ventana > mw.b ${loadaddr} 0 10
Ventana > md.b ${loadaddr} 10
12000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
Ventana > i2c bus 0
Bus 0: mxc0
Ventana > i2c read 0x51 0xDF.1 1 $loadaddr
Ventana > md.b ${loadaddr} 10
12000000: 13 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
Ventana > setexpr.b recovery *$loadaddr
Ventana > echo $recovery
13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment