OPEnSLab-OSU / Loom-V4

Open Source Internet Of Things Rapid Prototyping Framework For Environmental Sensing Applications
8 stars 1 forks source link

MUX TCA9548A does not initalize #35

Closed udellc closed 2 years ago

udellc commented 2 years ago

Describe the bug MUX example for Loom Sensors does not function. TCA9548A does not initalize.

Hardware in Use Feather M0 and Multiplexer breakout board for TCA9548A

To Reproduce Connect hardware, Attach an i2c sensor to one of the 8 ports, or don't - the device should report which sensors, if any, are on which MUX channel.

Expected behavior MUX should initialize in the serial printouts. Report sensors plugged into the MUX board and on which channel.

Code

/**
 * Uses the I2C Multiplexer to dynamically allow hot swapping of I2C sensors
 * 
 * MANAGER MUST BE INCLUDED FIRST IN ALL CODE
 */

#include <Loom_Manager.h>

#include <Hardware/Loom_Multiplexer/Loom_Multiplexer.h>

Manager manager("Device", 1);

// Reads the battery voltage
Loom_Multiplexer mux(manager);

void setup() {

  // Start the serial interface
  manager.beginSerial();

  // Initialize the manager
  manager.initialize();

  // Measure the data from the sensors
  manager.measure();

  // Package the data into JSON
  manager.package();

  // Print the JSON document to the Serial monitor
  manager.display_data();

}

void loop() {
  // put your main code here, to run repeatedly:

}

Config In the Arduino IDE while editing the config.json, goto 'Edit' -> 'Copy for HTML' and paste the output of that here

Output [Manager] Initializing Modules... [Manager] Setup Complete

[Manager] Data Json: { "type": "data", "id": { "name": "Device", "instance": 1 }, "contents": [ { "module": "Packet", "data": { "Number": 1 } } ] }

Additional context Add any other context about the problem here.

udellc commented 2 years ago

Attempted same code with Hypnos added to manager and powered on. This helps for some i2c sensors that have not yet been fixed. Hypnos initializes, but still no MUX, so issue is probably not related to the issue with some of the other i2c sensors:

Code:

/**
 * Uses the I2C Multiplexer to dynamically allow hot swapping of I2C sensors
 * 
 * MANAGER MUST BE INCLUDED FIRST IN ALL CODE
 */

#include <Loom_Manager.h>
#include <Hardware/Loom_Hypnos/Loom_Hypnos.h>

#include <Hardware/Loom_Multiplexer/Loom_Multiplexer.h>

Manager manager("Device", 1);
Loom_Hypnos hypnos(manager, HYPNOS_VERSION::V3_2, TIME_ZONE::PST);

// Reads the battery voltage
Loom_Multiplexer mux(manager);

void setup() {

  // Start the serial interface
  manager.beginSerial();
  hypnos.enable();

  // Initialize the manager
  manager.initialize();

  // Measure the data from the sensors
  manager.measure();

  // Package the data into JSON
  manager.package();

  // Print the JSON document to the Serial monitor
  manager.display_data();

}

void loop() {
  // put your main code here, to run repeatedly:

}

Printout: [SD Manager] Initializing SD Card... [SD Manager] Successfully initialized SD Card! [SD Manager] Data will be logged to Device0.csv [Hypnos] DS3231 Real-Time Clock Initialized Successfully! [Manager] Initializing Modules... [Manager] Setup Complete

[Manager] Data Json: { "type": "data", "id": { "name": "Device", "instance": 1 }, "contents": [ { "module": "Packet", "data": { "Number": 1 } } ], "timestamp": { "time_utc": "2022-09-13 21:15:56", "time_local": "2022-09-13 14:15:56" } }

WL-Richards commented 2 years ago

I fixed the mux issue it is in the integration-hell branch It just hadn't been pushed to main