My project involves talking to 16 IMU's at once. I can do 2 MPU6050 on one bus because of addressing, but I pretty much need 400kbps for throughput. I was looking over the pigpio library to see if I can bit bang 8 busses but it looks like the bbI2CZip function is blocking; can only talk to one bus at a time. I'm not too familiar with multi threaded programming, as a work around can I run 8 instances of my program that does 1 bus each? The program just needs to data log all the IMU's, either to the SD or send it to Matlab over wifi. Does this seem feasible on a PI2? Is there a better approach?
-
I'm guessing that trying to concurrently bitbang busses like that will at best limit you to the number of processor cores. It's an active userspace process, which is presumably why calls using it block, so if you do want to try this in parallel on a multicore pi, you will have to arrange your own threading.– goldilocks ♦Feb 5, 2017 at 16:57
-
So 4 instances of my code with one bus might work?– JetIgniter2k2Feb 5, 2017 at 17:43
1 Answer
What do you mean by at once?
You can buy two TCA9548A I2C multiplexors which will allow you to connect 16 MPU6050 on the same bus (at the same bus address). However only one MPU6050 may be addressed at any one instant in time.
-
Good suggestion but I've already gone down that route with a teensy. The data throughput pretty much limits me to two devices per bus. I can pull data from two MPU6050 FIFO buffers without issue. Hence I need 8 separate buses that all work independently and at the same time. Feb 5, 2017 at 17:36
-
The Pi3 has one hardware bus, the others two. So that is one or two concurrent devices. The Pi2/Pi3 have four cores so that is at most four concurrent devices if your software can be spread between cores. I'm not sure if the kernel is tied to a single core. If you need more than four concurrent devices you need another solution.– joanFeb 5, 2017 at 18:02