Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Matlab to r-pi to I2C device issue

  1. Jan 13, 2017 #1
    I have a 3-Axis Digital Compass IC HMC5883L I2C chip, I just want to use it to learn how to talk to sensors via a Matlab to raspberry-pie to I2C chip link. The set up from Matlab to the pi is straight forward and simple, the issue I'm having seems to be the address I'm being returned when scanning the I2C bus line, I get an address of '0x0D' instead of the data sheets default of '0x1E'. There are two lines of code, the creation of the pi object 'rpi', and the function to scan the bus line is simply

    rpi = raspi()
    scanI2CBus(rpi, 'i2c-1' )

    the argument 'i2c-1' tells the pi which bus line to scan, it is the only bus line available. Connections to the device are simple and have been checked and double checked, so I'm straight ruling that out. There is a built in matlab class for using this device with a pi, when I change the address it uses in this class to '0x0D' it clearly talks to the device but returns the error,

    Error using hmc5883l/testDevice (line 246)
    Error communicating with the HMC5883L sensor. The value read from ID_A, ID_B and ID_C registers do not match expected
    values.

    If I use the default address '0x1E' I get an error informing me that there is know device on the bus with that address.

    Does an incorrectly returned address normally mean a faulty chip?
     
  2. jcsd
  3. Jan 14, 2017 #2

    Svein

    User Avatar
    Science Advisor

    Remember that I2C addressing is a bit strange. The LSB of the address indicates whether the transaction is a Read or a Write.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: Matlab to r-pi to I2C device issue
  1. Matlab memory issues (Replies: 0)

  2. Strmm Issue (Replies: 1)

  3. Raspberry Pi 2 (Replies: 22)

Loading...