Hobbyist Toolkit

cancel
Showing results for 
Search instead for 
Did you mean: 

Problems using LINX to log data from 2 sensors with same I2C address using MUX board

Solved!
Go to solution

I am looking for help to log data from 2 or more Vishay 3020 proximity sensors using LabVIEW/LINX/Arduino and a SparkFun Qwiic MUX Breakout board.  The proximity sensors have a fixed I2C address (13hex), thus the SparkFun MUX board using the PCA9548 muxing chip to run multiple sensors simultaneously. 

 

When I run my code writing and reading the registers of just one proximity sensor (Sensor I2C address: 13hex) plugged directly into the Arduino/LINX, the code/sensor works just fine.  When I run the same single proximity sensor and code through the mux board, I know I am communicating with “something” on the mux (Mux I2C address: 70hex) because I am not getting “IC Read.vi errors”, but the sensor/code is not working properly as every register I try to read returns the register number as the contents/value of the register (i.e. reading register A2hex returns 162decimal as the value in the register).  Attempts to write to registers does seem to not work.

 

The PCA9548 datasheet suggests I need to write a byte to its control register to enable channels 0-7 on the mux board, but does not suggest what the number for the control register number.

 

When I try to read/scan the I2C address of the mux board/sensor using SparkFun IDE code, the code finds the 70hex address of the mux board in early loops but quickly the code jumps out of control creating a bunch of garbage in the Serial Monitor.  I have dug into the IDE Sparkfun MUX libraries to try to understand more, but this is getting over my head quickly as all my work on Arduino has been with LabVIEW/LINX.

 

I did not find anything helpful on the SparkFun Forums.

 

I have tried two different mux boards with the same results.  Does anyone have any ideas on how to move forward here?

 

Thanks in advance

0 Kudos
Message 1 of 2
(966 Views)
Solution
Accepted by topic author EntLabVIEW

The solution was non-intuitive to me, but rather simple.  I needed to close the I2C channel after selecting my MUX ports and then re-open the I2C channel to talk to my sensor.  A snippet of the basic communication block attached.

 

Old Routine (Not working)

  • Open I2C Channel 0
  • Select MUX port
  • Read/Write to Sensor
  • Close I2C Channel 0

 

New Routine (WORKING!!)

  • Open I2C Channel 0
  • Select MUX port
  • Close I2C Channel 0 (new!)
  • Open I2C Channel 0 (new!)
  • Read/Write to Sensor
  • Close I2C Channel 0
Message 2 of 2
(932 Views)