I2C same register for multiple sensors

ITALIAN VERSION BELOW


Hi all,

I'm working with IMU's and i bought these breakouts. As you can see it supports only I2C communication protocol.
I need to connect at least 3 breakout boards in the same I2C bus.
The arduino that i would use has only one bus for both SDA and SCL. Could someone help me to find a method to change the name of the register? Otherwise i cannot doing communicate the Arduino (as Master) and the sensors (as slave) with the same I2C bus.

Anyone had the same problem and gone over?

Thank you for your availability.


Ciao a tutti,

Sto lavorando con IMU e ho comprato [ questi breakout [/ url]. Come puoi vedere supporta solo il protocollo di comunicazione I2C.
Devo collegare almeno 3 schede breakout nello stesso bus I2C.
L'arduino che vorrei usare ha un solo bus sia per SDA che per SCL. Qualcuno potrebbe aiutarmi a trovare un metodo per modificare il nome del registro? Altrimenti non riesco a comunicare Arduino (come Master) e i sensori (come slave) con lo stesso bus I2C.

Qualcuno ha avuto lo stesso problema ed è andato oltre?

Grazie per la tua disponibilità.](https: //www.adafruit.com/product/3463)

Use an I2C multiplexer p.e. PCA9548A.

Yes, some kind of I2C multplexing will be needed. Both chips will support 2 addresses, but you need 3, and the selection line is not brought out for you to use, so you are stuck with 1 address for all.

Thank you for your advices. Nevertheless, is there a method to change the name of the register without using multiplexer (or similar). Hopefully by software?

The data sheet https://cdn-learn.adafruit.com/assets/assets/000/040/671/original/FXAS21002.pdf?1491475056 & https://cdn-learn.adafruit.com/assets/assets/000/043/458/original/FXOS8700CQ.pdf?1499125614 indicates that the device is, also, a SPI device. Hooking up 3 devices to one uController should not be an issue using SPI. Next each device on the module, there are two of them, have numerous registers located on each device.

For instance the FXOS8700CQ has a register called CTRL_REG4. In order to change that register you'd, look up that registers bit descriptors and set up the desired bits to change, and write the information to that registers address. Quite frankly, you'd want to use a pre-written library and use that libraries feature set to change that register, if you are unable to write I2C or SPI code yourself.

I'm sorry, i didn't get what you're saying.
Because i agree with you that the two sensors that i'm going to use are able to support SPI communication protocol as well, but i'm going to use 3 breakout boards already done. (the one that i linked above).
Its Pinout has Vin, 3V, GND, SDA, SCL in one side and AI1,AI2,GI1,GI2 in the other side.
I can connect and use only this PINs. Rigth? If yes, these PINs support only I2C communication and those one in the other side should be interrupt pin.

In the behind part, i'm sorry but i didn't get. Could you do another example please?

Idahowalker:
For instance the FXOS8700CQ has a register called CTRL_REG4. In order to change that register you'd, look up that registers bit descriptors and set up the desired bits to change, andwrite the information to that registers address. Quite frankly, you'd want to use a pre-written library and use that libraries feature set to change that register, if you are unable to write I2C or SPI code yourself.

Oi! That module only has I2C pin-outs and only 1 I2C address, good luck with that.

Here is an example of writing to a register of a LSM9DS1:

bool setupAccelScale ( int _range )
{
  esp_err_t intError = 0;
  uint8_t range = _range;
  fReadSPIdata16bits( hAG, LSM9DS1_REGISTER_CTRL_REG6_XL );
  uint8_t reg = GetHighBits();
  reg &= ~(0b00011000);
  reg |= range;
  fWriteSPIdata8bits( hAG, LSM9DS1_REGISTER_CTRL_REG6_XL, reg );
  switch (range)
  {
    case LSM9DS1_ACCELRANGE_2G:
      _accel_mg_lsb = LSM9DS1_ACCEL_MG_LSB_2G;
      ACCELrange = 2.0f;
      break;
    case LSM9DS1_ACCELRANGE_4G:
      _accel_mg_lsb = LSM9DS1_ACCEL_MG_LSB_4G;
      ACCELrange = 4.0f;
      break;
    case LSM9DS1_ACCELRANGE_8G:
      _accel_mg_lsb = LSM9DS1_ACCEL_MG_LSB_8G;
      ACCELrange = 8.0f;
      break;
    case LSM9DS1_ACCELRANGE_16G:
      _accel_mg_lsb = LSM9DS1_ACCEL_MG_LSB_16G;
      ACCELrange = 16.0f;
      break;
  }
  if ( intError )
  {
    return true;
  }
  else
  {
    return false;
  }
} // void setupAccel ( uint8_t range )

but I doubt that will help you.

Thank you for your advices. Nevertheless, is there a method to change the name of the register without using multiplexer (or similar). Hopefully by software?

No.