I will try to clarify a little more
What??
This LED should be on anyway. You should not be connecting anything that is powered to an unpowered Arduino. Therefore I don't understand.
With the enables from both of the multiplexers connected to the arduino and the arduino is not being powered the on LED is slightly illuminated. It isn't as strong as when the board is actually being powered. The board only does this when both are connected, whether they are connected to the same digital pin or connected to their own pins.
I am not sure if this is a fault or if this might be a sign that I am doing some damage to the arduino board itself.
I usually connect my hardware to the board before I power it up. Is it recommended to power the board before connecting my devices? I will also double check the schematic to see if the board that the multiplexer is on is already supplying power to the multiplexer.
When you ran the code did you have the i2cmaster library installed. the i2c_init fault may be caused if the library isn't installed since this is a call to that library. The I2cmaster library is NOT a default library installed with the arduino software. I probably should have mentioned this earlier and I apologize for not mentioning in the previous post.
I downloaded the library from
http://homepage.hispeed.ch/peterfleury/avr-software.html
I created an i2cmaster directory in the arduino libraries. arduino/libraries/i2cmaster. I copied the i2cmaster.h and the twimaster.c files into this directory. In order for this to work I had to change twimaster.c to twimaster.cpp.
Here is the link to the forum where I found how to do this.
http://forum.arduino.cc/index.php/topic,21317.0.html
Here is the code that I had used originally just to test the i2c library.
/*
Code using the i2c_master library for communications
with the bq20z80 chip (SMBus device).
*/
#include<Wire.h> //include for Wire library use
#include <i2cmaster.h> //include for i2cmaster library use
int muxAddress = 0x73; // Address for setting mux
int devAddress = 0x16; // Address for battery back read
int regValue = 0x51; // Register for safety status
int channel = 1; // value for selecting the proper battery channel
int data_high = 0; // high byte
int data_low = 0; // low byte
int pec=0; // pack errer byte
void setup()
{
i2c_init(); //Initialise the i2c bus
// Wire.begin();
Serial.begin(9600);
Serial.println("Scanning");
}
void loop()
{
Serial.println("Testing printout");
delay(2000);
Wire.beginTransmission(muxAddress); // connect to mux
Wire.write(channel); // send value 0b0001 channel 0
Wire.endTransmission(); // end transmission
// Next set of code is for reading the safety status bytes
i2c_rep_start(devAddress+I2C_WRITE); // Send start condition and write bit
i2c_write(regValue); // pointer to safety register
data_low = i2c_readAck(); // read byte 1 then send Ack
data_high = i2c_readAck(); // read 1 byte and then send ack
pec = i2c_readNak(); //read error check byte and send Nack to thel the device no more data to to send
i2c_stop(); //releas bus end transaction
Serial.println("output of Safety Status register");
Serial.print("Hex value High= ");
Serial.print(data_high, HEX);
Serial.println("output of Safety Status register");
Serial.print("Hex value Low= ");
Serial.print(data_low, HEX);
delay(3000);
}
This code utilizes the Wire.h library to write to the mux address with the value of the channel that I want to read. I then use the i2cmaster library to communicate to the battery back which is an SMBus device.
I have compiled and used all of the code that I have sent you. The only issue that I am having is when I have both multiplexers connected to the arduino.
If you would like I can send you more code of me using the i2cmaster library. I didn't want to flood the post with all of the test coding that I have done regarding this project.
@jacksons
Thank you for the suggestion but it still comes on a little bit when they are connected to different digital pins.