In addition to being a normal I2C slave device (mode 1), the LSM6DSO also has three special modes, as shown below:
Mode 2 is the I2C HUB mode, which acts as an I2C HUB and connects other I2C slave devices. In mode 2/3/4, the SDx/SCx pins of the chip act as the SDA/SCL pins of the I2C HUB.
For the X-NUCLEO-IKS01A3 development board, the standard mode is used by default. The jumpers of JP7 and JP8 are connected to 1-2 and 3-4, so that I2C1 and I2C2 are short-circuited, SDx and SCx of LSM6DSO are connected to GND, and the I2C of the six sensors are connected together through U6/U7 (ST2378E).
If using I2C HUB mode, you need to change the connection method of the short-circuit block of JP7/JP8 and short-circuit 2-3 so that I2C1_SDA/I2C1/SCL can be connected to SDx/SCx.
However, the I2C HUB still cannot work just by changing the jumper, because by default, LSM6DSO does not allow this function, and the chip working mode needs to be set through the register. Although the setting is not complicated, there are too many registers in LSM6DSO. I believe that most netizens do not have the patience to read them all. The following is a brief introduction to the setting method.
First, you need to modify the FUNC_CFG_ACCESS register and set the SHUB_REG ACCESS to 1 to enable the sensor hub (IC master) register access function.
Secondly, set the PASS_THROUGH_MODE (pass-through mode) in the sensor hub register MASTER_CONFIG to 1 to enable the I2C HUB function.
The following uses MicroPython as an example to introduce the specific usage:
First, connect J2 (I2C and power) of the X-NUCLEO-IKS01A3 development board to the MicroPython development board. For specific methods, please refer to the post " Connecting X-NUCLEO-IKS01A3 using MicroPython ".
Take PYB Nano as an example, use to connect to I2C1. Then scan the devices on the I2C bus (X-NUCLEO-IKS01A3 has been switched to HUB mode), and you can find 3 devices, of which device 76 is the acceleration sensor MMA7660 on PYB Nano, device 25 is the LIS2DW12 magnetic field sensor on X-NUCLEO-IKS01A3, and device 107 is LSM6DSO.
Set the register FUNC_CFG_ACCESS and register MASTER_CONFIG in sequence, and then scan the I2C bus again, and you will find that other sensors have been connected to the I2C HUB.
This content is originally created by dcexpert, a user of EEWORLD forum. If you want to reprint or use it for commercial purposes, you must obtain the author's consent and indicate the source